#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 */
scalar_t__ is_bouncy(int);
int /*<<< orphan*/ is_ratio_reached(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, bouncy = 0, non_bouncy = 99;
  for (i = 100; !is_ratio_reached(bouncy, non_bouncy); i++) {
    if (is_bouncy(i)) {
      bouncy++;
    } else {
      non_bouncy++;
    }
  }
  printf("The first number that satisfies the condition is %i\n", i - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x63,-0x10(%rbp)
movl   $0x64,-0x8(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1050 <is_ratio_reached@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1174 <main+0x44>
jmp    11b0 <main+0x80>
mov    -0x8(%rbp),%edi
call   1040 <is_bouncy@plt>
cmp    $0x0,%rax
je     1194 <main+0x64>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119d <main+0x6d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a2 <main+0x72>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x24>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebp,%ebp
mov    $0x63,%r14d
xor    %edi,%edi
mov    $0x63,%esi
call   1050 <is_ratio_reached@plt>
test   %eax,%eax
jne    118a <main+0x5a>
mov    $0x63,%r14d
mov    $0x63,%ebx
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14d
mov    %r14d,%edi
call   1040 <is_bouncy@plt>
xor    %ecx,%ecx
xor    %edx,%edx
test   %rax,%rax
sete   %cl
setne  %dl
add    %edx,%ebp
add    %ecx,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <is_ratio_reached@plt>
test   %eax,%eax
je     1160 <main+0x30>
lea    0xe6f(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"The first number that satisfies the condition is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 99, i32* %4
store i32 100, i32* %2
br label %5
5: ; preds = %22, %0
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @is_ratio_reached(i32 %6, i32 %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %25
11: ; preds = %5
%12 = load i32, i32* %2
%13 = call i64 @is_bouncy(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %21
18: ; preds = %11
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %21
21: ; preds = %18, %15
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %5
25: ; preds = %5
%26 = load i32, i32* %2
%27 = sub nsw i32 %26, 1
%28 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [53 x i8] c"The first number that satisfies the condition is %i\0A\00"
define i32 @main() {
%1 = tail call i32 @is_ratio_reached(i32 0, i32 99)
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %17
3: ; preds = %0, %3
%4 = phi i32 [ %13, %3 ], [ 99, %0 ]
%5 = phi i32 [ %11, %3 ], [ 0, %0 ]
%6 = phi i32 [ %14, %3 ], [ 100, %0 ]
%7 = tail call i64 @is_bouncy(i32 %6)
%8 = icmp eq i64 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %5, %10
%12 = zext i1 %8 to i32
%13 = add nuw nsw i32 %4, %12
%14 = add nuw nsw i32 %6, 1
%15 = tail call i32 @is_ratio_reached(i32 %11, i32 %13)
%16 = icmp eq i32 %15, 0
br i1 %16, label %3, label %17
17: ; preds = %3, %0
%18 = phi i32 [ 99, %0 ], [ %6, %3 ]
%19 = tail call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %18)
ret i32 0
}