#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 EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ measure(int, int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int count = -1;
  if (argc == 2) {
    count = atoi(argv[1]);
  }
  for (;;) {
    printf("Hundred thousand prime numbers in %ld ms\n", measure(97, 100000));
    if (count != -1) {
      if (--count == 0) {
        break;
      }
    }
  }
  return (EXIT_SUCCESS);
}


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   $0xffffffff,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1167 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    116c <main+0x3c>
mov    $0x61,%edi
mov    $0x186a0,%esi
call   1040 <measure@plt>
mov    %eax,%esi
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0xffffffff,-0x14(%rbp)
je     11af <main+0x7f>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    11aa <main+0x7a>
jmp    11b4 <main+0x84>
jmp    11af <main+0x7f>
jmp    116c <main+0x3c>
mov    0x2e25(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xffffffff,%eax
cmp    $0x2,%edi
jne    1146 <main+0x16>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
lea    0xeb3(%rip),%rbx
nopl   (%rax)
mov    %eax,%ebp
mov    $0x61,%edi
mov    $0x186a0,%esi
call   1040 <measure@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
cmp    $0xffffffff,%ebp
je     1150 <main+0x20>
add    $0xffffffff,%ebp
mov    %ebp,%eax
jne    1150 <main+0x20>
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Hundred thousand prime numbers in %ld ms\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
br label %14
14: ; preds = %9, %2
br label %15
15: ; preds = %26, %14
%16 = call i32 @measure(i32 97, i32 100000)
%17 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %6
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %26
20: ; preds = %15
%21 = load i32, i32* %6
%22 = add nsw i32 %21, -1
store i32 %22, i32* %6
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
br label %27
25: ; preds = %20
br label %26
26: ; preds = %25, %15
br label %15
27: ; preds = %24
%28 = load i32, i32* @EXIT_SUCCESS
ret i32 %28
}

LLVM IR (-O2):
@.str = [42 x i8] c"Hundred thousand prime numbers in %ld ms\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ -1, %2 ], [ %7, %4 ]
br label %10
10: ; preds = %18, %8
%11 = phi i32 [ %9, %8 ], [ %19, %18 ]
%12 = tail call i32 @measure(i32 97, i32 100000)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = icmp eq i32 %11, -1
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = add nsw i32 %11, -1
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15, %10
%19 = phi i32 [ %16, %15 ], [ -1, %10 ]
br label %10
20: ; preds = %15
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}