#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 count;
  printf("Prime numbers from 1 to 50\n");
  for (int i = 1; i <= 50; i++) {
    count = 0;
    for (int j = 1; j <= i; j++) {
      if (i % j == 0)
        count++;
    }
    if (count == 2)
      printf("%d \t", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x32,-0xc(%rbp)
jg     11b2 <main+0xa2>
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1184 <main+0x74>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1171 <main+0x61>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1176 <main+0x66>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114c <main+0x3c>
cmpl   $0x2,-0x8(%rbp)
jne    119f <main+0x8f>
mov    -0xc(%rbp),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a4 <main+0x94>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    $0x2,%r12d
lea    0xeba(%rip),%r14
xor    %r15d,%r15d
jmp    115d <main+0x3d>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0x1,%r12d
cmp    $0x34,%r12d
je     11d5 <main+0xb5>
mov    %r15d,%eax
lea    0x1(%rax),%r15d
mov    $0x1,%ebp
mov    $0x0,%ecx
test   %eax,%eax
je     11ad <main+0x8d>
mov    %ebx,%esi
and    $0xfffffffe,%esi
neg    %esi
xor    %ecx,%ecx
mov    $0x1,%edi
mov    %ebx,%eax
xor    %edx,%edx
div    %edi
cmp    $0x1,%edx
adc    $0x0,%ecx
lea    0x1(%rdi),%ebp
mov    %ebx,%eax
xor    %edx,%edx
div    %ebp
cmp    $0x1,%edx
adc    $0x0,%ecx
mov    %edi,%ebp
add    $0x2,%ebp
lea    (%rsi,%rdi,1),%eax
add    $0x2,%eax
mov    %ebp,%edi
cmp    $0x1,%eax
jne    1180 <main+0x60>
test   $0x1,%r15b
je     11bf <main+0x9f>
mov    %ebx,%eax
xor    %edx,%edx
div    %ebp
cmp    $0x1,%edx
adc    $0x0,%ecx
cmp    $0x2,%ecx
jne    1150 <main+0x30>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Prime numbers from 1 to 50\0A\00"
@.str.1 = [5 x i8] c"%d \09\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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %6
6: ; preds = %33, %0
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 50
br i1 %8, label %9, label %36
9: ; preds = %6
store i32 0, i32* %2
store i32 1, i32* %4
br label %10
10: ; preds = %23, %9
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %26
14: ; preds = %10
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = srem i32 %15, %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %22
22: ; preds = %19, %14
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %10
26: ; preds = %10
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %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 %6
36: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d \09\00"
@str = [27 x i8] c"Prime numbers from 1 to 50\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %43
%3 = phi i32 [ 0, %0 ], [ %47, %43 ]
%4 = phi i32 [ 2, %0 ], [ %45, %43 ]
%5 = phi i32 [ 1, %0 ], [ %44, %43 ]
%6 = add i32 %3, 1
%7 = and i32 %6, 1
%8 = icmp eq i32 %3, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = and i32 %6, -2
br label %25
11: ; preds = %43
ret i32 0
12: ; preds = %25, %2
%13 = phi i32 [ undef, %2 ], [ %37, %25 ]
%14 = phi i32 [ 1, %2 ], [ %38, %25 ]
%15 = phi i32 [ 0, %2 ], [ %37, %25 ]
%16 = icmp eq i32 %7, 0
br i1 %16, label %22, label %17
17: ; preds = %12
%18 = urem i32 %5, %14
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = add nuw nsw i32 %15, %20
br label %22
22: ; preds = %12, %17
%23 = phi i32 [ %13, %12 ], [ %21, %17 ]
%24 = icmp eq i32 %23, 2
br i1 %24, label %41, label %43
25: ; preds = %25, %9
%26 = phi i32 [ 1, %9 ], [ %38, %25 ]
%27 = phi i32 [ 0, %9 ], [ %37, %25 ]
%28 = phi i32 [ 0, %9 ], [ %39, %25 ]
%29 = urem i32 %5, %26
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = add nuw nsw i32 %27, %31
%33 = add nuw nsw i32 %26, 1
%34 = urem i32 %5, %33
%35 = icmp eq i32 %34, 0
%36 = zext i1 %35 to i32
%37 = add nuw nsw i32 %32, %36
%38 = add nuw nsw i32 %26, 2
%39 = add i32 %28, 2
%40 = icmp eq i32 %39, %10
br i1 %40, label %12, label %25
41: ; preds = %22
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %5)
br label %43
43: ; preds = %22, %41
%44 = add nuw nsw i32 %5, 1
%45 = add nuw nsw i32 %4, 1
%46 = icmp eq i32 %45, 52
%47 = add i32 %3, 1
br i1 %46, label %11, label %2
}