#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*/ is_prime(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int);
int main(int argc, const char **argv) {
  int maxnum = 100000;
  unsigned int i = 2;
  for (i = 2; i < maxnum; i++) {
    if (!is_prime(i)) {
      printf("%d\n", i);
    }
  }
}


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)
movl   $0x186a0,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    118a <main+0x6a>
mov    -0x18(%rbp),%edi
call   1040 <is_prime@plt>
cmp    $0x0,%eax
jne    1177 <main+0x57>
mov    -0x18(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <main+0x5c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <main+0x2b>
mov    -0x4(%rbp),%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    114b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x186a0,%ebx
je     1162 <main+0x42>
mov    %ebx,%edi
call   1040 <is_prime@plt>
test   %eax,%eax
jne    1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %9
%4 = phi i32 [ 2, %2 ], [ %10, %9 ]
%5 = tail call i32 @is_prime(i32 %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %9
9: ; preds = %3, %7
%10 = add nuw nsw i32 %4, 1
%11 = icmp eq i32 %10, 100000
br i1 %11, label %12, label %3
12: ; preds = %9
ret i32 0
}