#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 /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int p, d;
  bool isPrime, isOdd;
  printf("2 ");
  for (p = 3; p <= 50; p += 2) {
    for (d = 2, isPrime = true; d < p && isPrime; ++d)
      if (0 == p % d)
        isPrime = false;
    if (isPrime)
      printf("%i ", p);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jg     11d0 <main+0xc0>
movl   $0x2,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x15(%rbp)
jge    1167 <main+0x57>
cmpl   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1177 <main+0x67>
jmp    11a2 <main+0x92>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
jne    118f <main+0x7f>
movl   $0x0,-0x10(%rbp)
jmp    1194 <main+0x84>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114c <main+0x3c>
cmpl   $0x0,-0x10(%rbp)
je     11bd <main+0xad>
mov    -0x8(%rbp),%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c2 <main+0xb2>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <main+0x24>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3,%ebx
lea    0xec5(%rip),%r14
jmp    114a <main+0x2a>
lea    0x2(%rbx),%eax
cmp    $0x31,%ebx
mov    %eax,%ebx
jae    1176 <main+0x56>
mov    $0x3,%ecx
nop
lea    -0x1(%rcx),%esi
mov    %ebx,%eax
xor    %edx,%edx
div    %esi
cmp    %ebx,%ecx
jae    1164 <main+0x44>
add    $0x1,%ecx
test   %edx,%edx
jne    1150 <main+0x30>
test   %edx,%edx
je     1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1140 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"2 \00"
@.str.1 = [4 x i8] c"%i \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 3, i32* %2
br label %7
7: ; preds = %37, %0
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 50
br i1 %9, label %10, label %40
10: ; preds = %7
store i32 2, i32* %3
store i32 1, i32* %4
br label %11
11: ; preds = %27, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
br label %18
18: ; preds = %15, %11
%19 = phi i1 [ false, %11 ], [ %17, %15 ]
br i1 %19, label %20, label %30
20: ; preds = %18
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = srem i32 %21, %22
%24 = icmp eq i32 0, %23
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 0, i32* %4
br label %26
26: ; preds = %25, %20
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %11
30: ; preds = %18
%31 = load i32, i32* %4
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %2
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33, %30
br label %37
37: ; preds = %36
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 2
store i32 %39, i32* %2
br label %7
40: ; preds = %7
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"2 \00"
@.str.1 = [4 x i8] c"%i \00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %14
%3 = phi i32 [ 3, %0 ], [ %15, %14 ]
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 2, %2 ], [ %8, %4 ]
%6 = urem i32 %3, %5
%7 = icmp ne i32 %6, 0
%8 = add nuw nsw i32 %5, 1
%9 = icmp ult i32 %8, %3
%10 = and i1 %9, %7
br i1 %10, label %4, label %11
11: ; preds = %4
br i1 %7, label %12, label %14
12: ; preds = %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %14
14: ; preds = %11, %12
%15 = add nuw nsw i32 %3, 2
%16 = icmp ult i32 %3, 49
br i1 %16, label %2, label %17
17: ; preds = %14
%18 = tail call i32 @putchar(i32 10)
ret i32 0
}