#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int fact(int);
int isPrime(int);
int is_prime(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("");
  int n = 0;
  do {
    switch (n % 3) {
    case 0:
      printf("%d\n", fact(n));
      break;
    case 1:
      printf("%d\n", is_prime(n));
    default:
      printf("%d, %d\n", fact(n), isPrime(n));
    }
  } while (n++ < 10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
mov    %ecx,%eax
imul   $0x55555556,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
je     11ab <main+0x6b>
jmp    119a <main+0x5a>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
je     11c8 <main+0x88>
jmp    11e0 <main+0xa0>
mov    -0x14(%rbp),%edi
call   1060 <fact@plt>
mov    %eax,%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <main+0xc6>
mov    -0x14(%rbp),%edi
call   1050 <is_prime@plt>
mov    %eax,%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <fact@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <isPrime@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120b <main+0xcb>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0xa,%eax
jl     116b <main+0x2b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xaaaaaaab,%r12d
lea    0xeaf(%rip),%r14
lea    0xea4(%rip),%r15
xor    %ebp,%ebp
jmp    1199 <main+0x59>
mov    %ebp,%edi
call   1050 <is_prime@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%edi
call   1060 <fact@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1040 <isPrime@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0xb,%ebp
je     11c8 <main+0x88>
mov    %ebp,%eax
imul   %r12,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%ecx
mov    %ebp,%eax
sub    %ecx,%eax
cmp    $0x1,%eax
je     1160 <main+0x20>
test   %eax,%eax
jne    1173 <main+0x33>
mov    %ebp,%edi
call   1060 <fact@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1191 <main+0x51>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [8 x i8] c"%d, %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %8
8: ; preds = %26, %2
%9 = load i32, i32* %6
%10 = srem i32 %9, 3
switch i32 %10, label %19 [
i32 0, label %11
i32 1, label %15
]
11: ; preds = %8
%12 = load i32, i32* %6
%13 = call i32 @fact(i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %25
15: ; preds = %8
%16 = load i32, i32* %6
%17 = call i32 @is_prime(i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %8, %15
%20 = load i32, i32* %6
%21 = call i32 @fact(i32 %20)
%22 = load i32, i32* %6
%23 = call i32 @isPrime(i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %23)
br label %25
25: ; preds = %19, %11
br label %26
26: ; preds = %25
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
%29 = icmp slt i32 %27, 10
br i1 %29, label %8, label %30
30: ; preds = %26
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [8 x i8] c"%d, %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %18, %2
%4 = phi i32 [ 0, %2 ], [ %19, %18 ]
%5 = trunc i32 %4 to i8
%6 = urem i8 %5, 3
%7 = zext i8 %6 to i32
switch i32 %7, label %14 [
i32 0, label %8
i32 1, label %11
]
8: ; preds = %3
%9 = tail call i32 @fact(i32 %4)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %18
11: ; preds = %3
%12 = tail call i32 @is_prime(i32 %4)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %3, %11
%15 = tail call i32 @fact(i32 %4)
%16 = tail call i32 @isPrime(i32 %4)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %16)
br label %18
18: ; preds = %8, %14
%19 = add nuw nsw i32 %4, 1
%20 = icmp eq i32 %19, 11
br i1 %20, label %21, label %3
21: ; preds = %18
ret i32 0
}