#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 getpid();
int /*<<< orphan*/ nice(int);
int /*<<< orphan*/ primes(int);
int /*<<< orphan*/ printf(char *);
int main() {
  int i;
  int my_pid = getpid();
  nice(15);
  for (i = 0; i < 100; i++) {
    int j = 10000;
    while (j > 0) {
      int k = 10000;
      while (k > 0) {
        k--;
      }
      j--;
    }
    primes(i);
  }
  printf("end!");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0xc(%rbp)
mov    $0xf,%edi
call   1050 <nice@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    11c8 <main+0x88>
movl   $0x2710,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    11b2 <main+0x72>
movl   $0x2710,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11a4 <main+0x64>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    118c <main+0x4c>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    117b <main+0x3b>
mov    -0x8(%rbp),%edi
call   1060 <primes@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116a <main+0x2a>
lea    0xe31(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    $0xf,%edi
call   1050 <nice@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
call   1060 <primes@plt>
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1160 <main+0x20>
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"end!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @getpid()
store i32 %6, i32* %3
%7 = call i32 @nice(i32 15)
store i32 0, i32* %2
br label %8
8: ; preds = %28, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 100
br i1 %10, label %11, label %31
11: ; preds = %8
store i32 10000, i32* %4
br label %12
12: ; preds = %22, %11
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %12
store i32 10000, i32* %5
br label %16
16: ; preds = %19, %15
%17 = load i32, i32* %5
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %5
%21 = add nsw i32 %20, -1
store i32 %21, i32* %5
br label %16
22: ; preds = %16
%23 = load i32, i32* %4
%24 = add nsw i32 %23, -1
store i32 %24, i32* %4
br label %12
25: ; preds = %12
%26 = load i32, i32* %2
%27 = call i32 @primes(i32 %26)
br label %28
28: ; preds = %25
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %8
31: ; preds = %8
%32 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [5 x i8] c"end!\00"
define i32 @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @nice(i32 15)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %6, %3 ]
%5 = tail call i32 @primes(i32 %4)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 100
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}