#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;
  printf("2 ");
  for (p = 3; p <= 50; p += 2) {
    isPrime = true;
    for (d = 3; d < p && isPrime; d += 2)
      if (p % d == 0)
        isPrime = false;
    if (isPrime != false)
      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     11cf <main+0xbf>
movl   $0x1,-0x10(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x11(%rbp)
jge    1167 <main+0x57>
cmpl   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1177 <main+0x67>
jmp    11a1 <main+0x91>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    118e <main+0x7e>
movl   $0x0,-0x10(%rbp)
jmp    1193 <main+0x83>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    114c <main+0x3c>
cmpl   $0x0,-0x10(%rbp)
je     11bc <main+0xac>
mov    -0x8(%rbp),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c1 <main+0xb1>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <main+0x24>
lea    0xe31(%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    1156 <main+0x36>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x2(%rbx),%eax
cmp    $0x31,%ebx
mov    %eax,%ebx
jae    117a <main+0x5a>
cmp    $0x4,%ebx
jb     1140 <main+0x20>
mov    $0x5,%ecx
lea    -0x2(%rcx),%esi
mov    %ebx,%eax
xor    %edx,%edx
div    %esi
cmp    %ebx,%ecx
jae    1174 <main+0x54>
add    $0x2,%ecx
test   %edx,%edx
jne    1160 <main+0x40>
test   %edx,%edx
jne    1140 <main+0x20>
jmp    114c <main+0x2c>
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
store i32 0, i32* %1
%5 = 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 %6
6: ; preds = %36, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 50
br i1 %8, label %9, label %39
9: ; preds = %6
store i32 1, i32* %4
store i32 3, i32* %3
br label %10
10: ; preds = %26, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 0
br label %17
17: ; preds = %14, %10
%18 = phi i1 [ false, %10 ], [ %16, %14 ]
br i1 %18, label %19, label %29
19: ; preds = %17
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = srem i32 %20, %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 0, i32* %4
br label %25
25: ; preds = %24, %19
br label %26
26: ; preds = %25
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 2
store i32 %28, i32* %3
br label %10
29: ; preds = %17
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* %2
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %32, %29
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 2
store i32 %38, i32* %2
br label %6
39: ; preds = %6
%40 = 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, %15
%3 = phi i32 [ 3, %0 ], [ %16, %15 ]
%4 = icmp ugt i32 %3, 3
br i1 %4, label %5, label %13
5: ; preds = %2, %5
%6 = phi i32 [ %9, %5 ], [ 3, %2 ]
%7 = urem i32 %3, %6
%8 = icmp ne i32 %7, 0
%9 = add nuw nsw i32 %6, 2
%10 = icmp ult i32 %9, %3
%11 = and i1 %10, %8
br i1 %11, label %5, label %12
12: ; preds = %5
br i1 %8, label %13, label %15
13: ; preds = %2, %12
%14 = 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 %15
15: ; preds = %12, %13
%16 = add nuw nsw i32 %3, 2
%17 = icmp ult i32 %3, 49
br i1 %17, label %2, label %18
18: ; preds = %15
%19 = tail call i32 @putchar(i32 10)
ret i32 0
}