#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 is_prime(int);
int /*<<< orphan*/ print_function(int, int);
int run_100times(int i, int prime_num, int prime_100) {
  for (prime_100 = 0; prime_100 < 100; i++)
    if (is_prime(i) == 1) {
      prime_num++;
      prime_100++;
      print_function(prime_num, i);
    }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jge    1183 <run_100times+0x63>
mov    -0x8(%rbp),%edi
call   1040 <is_prime@plt>
cmp    $0x1,%eax
jne    1170 <run_100times+0x50>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <print_function@plt>
jmp    1175 <run_100times+0x55>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1138 <run_100times+0x18>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
xor    %ebx,%ebx
jmp    1138 <run_100times+0x18>
nopl   (%rax)
add    $0x1,%ebp
cmp    $0x64,%ebx
jge    1157 <run_100times+0x37>
mov    %ebp,%edi
call   1040 <is_prime@plt>
cmp    $0x1,%eax
jne    1130 <run_100times+0x10>
add    $0x1,%r14d
add    $0x1,%ebx
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <print_function@plt>
jmp    1130 <run_100times+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @run_100times(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 0, i32* %7
br label %8
8: ; preds = %24, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 100
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32, i32* %5
%13 = call i32 @is_prime(i32 %12)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = load i32, i32* %5
%22 = call i32 @print_function(i32 %20, i32 %21)
br label %23
23: ; preds = %15, %11
br label %24
24: ; preds = %23
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %8
27: ; preds = %8
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @run_100times(i32 %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %3, %14
%5 = phi i32 [ 0, %3 ], [ %16, %14 ]
%6 = phi i32 [ %1, %3 ], [ %15, %14 ]
%7 = phi i32 [ %0, %3 ], [ %17, %14 ]
%8 = tail call i32 @is_prime(i32 %7)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = add nsw i32 %6, 1
%12 = add nsw i32 %5, 1
%13 = tail call i32 @print_function(i32 %11, i32 %7)
br label %14
14: ; preds = %4, %10
%15 = phi i32 [ %11, %10 ], [ %6, %4 ]
%16 = phi i32 [ %12, %10 ], [ %5, %4 ]
%17 = add nsw i32 %7, 1
%18 = icmp slt i32 %16, 100
br i1 %18, label %4, label %19
19: ; preds = %14
ret i32 undef
}