#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;
  for (p = 2; p <= 50; ++p) {
    isPrime = true;
    if (p > 2 && p % 2 == 0) {
      isPrime = false;
    } else {
      for (d = 2; d < p && isPrime == true; ++d)
        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)
movl   $0x2,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jg     11f0 <main+0xe0>
movl   $0x1,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1161 <main+0x51>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1161 <main+0x51>
movl   $0x0,-0x10(%rbp)
jmp    11c2 <main+0xb2>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x11(%rbp)
jge    1183 <main+0x73>
cmpl   $0x1,-0x10(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1193 <main+0x83>
jmp    11bd <main+0xad>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11aa <main+0x9a>
movl   $0x0,-0x10(%rbp)
jmp    11af <main+0x9f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1168 <main+0x58>
jmp    11c2 <main+0xb2>
cmpl   $0x0,-0x10(%rbp)
je     11dd <main+0xcd>
mov    -0x8(%rbp),%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e2 <main+0xd2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
lea    0xe0d(%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
mov    $0x2,%ebx
lea    0xed0(%rip),%r14
jmp    1154 <main+0x34>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x33,%ebx
je     118a <main+0x6a>
cmp    $0x3,%ebx
jb     1160 <main+0x40>
mov    %ebx,%eax
and    $0x1,%eax
je     114c <main+0x2c>
cmp    $0x3,%ebx
jb     1140 <main+0x20>
mov    $0x3,%ecx
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rcx),%esi
mov    %ebx,%eax
xor    %edx,%edx
div    %esi
cmp    %ebx,%ecx
jae    1184 <main+0x64>
add    $0x1,%ecx
test   %edx,%edx
jne    1170 <main+0x50>
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 = [4 x i8] c"%i \00"
@.str.1 = [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
store i32 2, i32* %2
br label %5
5: ; preds = %44, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 50
br i1 %7, label %8, label %47
8: ; preds = %5
store i32 1, i32* %4
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* %2
%13 = srem i32 %12, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 0, i32* %4
br label %37
16: ; preds = %11, %8
store i32 2, i32* %3
br label %17
17: ; preds = %33, %16
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 1
br label %24
24: ; preds = %21, %17
%25 = phi i1 [ false, %17 ], [ %23, %21 ]
br i1 %25, label %26, label %36
26: ; preds = %24
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = srem i32 %27, %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 0, i32* %4
br label %32
32: ; preds = %31, %26
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %17
36: ; preds = %24
br label %37
37: ; preds = %36, %15
%38 = load i32, i32* %4
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %40, %37
br label %44
44: ; preds = %43
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
store i32 %46, i32* %2
br label %5
47: ; preds = %5
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

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