// #target: macos-x64

module test;

macro getisprime($x)
{
    $switch $x:
        $case 1:
        $case 2:
        $case 3:
        $case 5:
        $case 7:
        $case 11:
        $case 13:
            return "prime";
        $case 4:
        $case 6:
        $case 8:
        $case 9:
        $case 10:
        $case 12:
            return "not_prime";
        $case 17:
        $default:
            return "donnowifprime";
    $endswitch
}

extern fn void printf(char*, ...);

fn void main()
{
    printf("%s\n", getisprime(3));
    printf("%s\n", getisprime(12));
    printf("%s\n", getisprime(4));
    printf("%s\n", getisprime(100));
    printf("%s\n", getisprime(17));
}

/* #expect: test.ll

@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"prime\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"not_prime\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.5 = private unnamed_addr constant [10 x i8] c"not_prime\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.7 = private unnamed_addr constant [14 x i8] c"donnowifprime\00", align 1
@.str.8 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.9 = private unnamed_addr constant [14 x i8] c"donnowifprime\00", align 1


declare void @printf(ptr, ...) #0


define void @test.main() #0 {
entry:
  call void (ptr, ...) @printf(ptr @.str, ptr @.str.1)
  call void (ptr, ...) @printf(ptr @.str.2, ptr @.str.3)
  call void (ptr, ...) @printf(ptr @.str.4, ptr @.str.5)
  call void (ptr, ...) @printf(ptr @.str.6, ptr @.str.7)
  call void (ptr, ...) @printf(ptr @.str.8, ptr @.str.9)
  ret void
}
