#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 INT_MAX;
int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ is_bouncy(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "usage: %s <N>\n", argv[0]);
    return 1;
  }
  int N = atoi(argv[1]);
  if (N < 0 || N > 99)
    return 1;
  int bouncy_count = 0;
  for (int i = 1; i < INT_MAX / 100; i++) {
    if (is_bouncy(i))
      bouncy_count++;
    if (bouncy_count * 100 == i * N) {
      printf("%d\n", i);
      return 0;
    }
  }
  return 1;
}


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)
cmpl   $0x2,-0x8(%rbp)
je     1188 <main+0x48>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    124d <main+0x10d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11ac <main+0x6c>
cmpl   $0x63,-0x14(%rbp)
jle    11b8 <main+0x78>
movl   $0x1,-0x4(%rbp)
jmp    124d <main+0x10d>
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    1246 <main+0x106>
mov    -0x1c(%rbp),%edi
call   1040 <is_bouncy@plt>
cmp    $0x0,%rax
je     1205 <main+0xc5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
imul   $0x64,-0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x14(%rbp),%ecx
cmp    %ecx,%eax
jne    1233 <main+0xf3>
mov    -0x1c(%rbp),%esi
lea    0xded(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124d <main+0x10d>
jmp    1238 <main+0xf8>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c6 <main+0x86>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x2,%edi
jne    11b9 <main+0x79>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%r15d
mov    $0x1,%eax
cmp    $0x63,%r15d
ja     11d6 <main+0x96>
mov    0x2e7d(%rip),%r14
cmpl   $0xc8,(%r14)
jl     11d6 <main+0x96>
mov    $0x1,%ebp
xor    %r12d,%r12d
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %ebp,%edi
call   1040 <is_bouncy@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
imul   $0x64,%ebx,%eax
add    %r15d,%r12d
cmp    %eax,%r12d
je     11df <main+0x9f>
add    $0x1,%ebp
movslq (%r14),%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
cmp    %eax,%ebp
jl     1180 <main+0x40>
jmp    11d1 <main+0x91>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe34(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe29(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
jmp    11d6 <main+0x96>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"usage: %s <N>\0A\00"
@INT_MAX = global i32 0
@.str.1 = [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
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 1, i32* %3
br label %56
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %17
%25 = load i32, i32* %6
%26 = icmp sgt i32 %25, 99
br i1 %26, label %27, label %28
27: ; preds = %24, %17
store i32 1, i32* %3
br label %56
28: ; preds = %24
store i32 0, i32* %7
store i32 1, i32* %8
br label %29
29: ; preds = %52, %28
%30 = load i32, i32* %8
%31 = load i32, i32* @INT_MAX
%32 = sdiv i32 %31, 100
%33 = icmp slt i32 %30, %32
br i1 %33, label %34, label %55
34: ; preds = %29
%35 = load i32, i32* %8
%36 = call i64 @is_bouncy(i32 %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %41
41: ; preds = %38, %34
%42 = load i32, i32* %7
%43 = mul nsw i32 %42, 100
%44 = load i32, i32* %8
%45 = load i32, i32* %6
%46 = mul nsw i32 %44, %45
%47 = icmp eq i32 %43, %46
br i1 %47, label %48, label %51
48: ; preds = %41
%49 = load i32, i32* %8
%50 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %49)
store i32 0, i32* %3
br label %56
51: ; preds = %41
br label %52
52: ; preds = %51
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 1
store i32 %54, i32* %8
br label %29
55: ; preds = %29
store i32 1, i32* %3
br label %56
56: ; preds = %55, %48, %27, %11
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"usage: %s <N>\0A\00"
@INT_MAX = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %33
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = icmp ult i32 %11, 100
%13 = load i32, i32* @INT_MAX
%14 = icmp sgt i32 %13, 199
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %16, label %33
16: ; preds = %8, %28
%17 = phi i32 [ %29, %28 ], [ 1, %8 ]
%18 = phi i32 [ %22, %28 ], [ 0, %8 ]
%19 = tail call i64 @is_bouncy(i32 %17)
%20 = icmp ne i64 %19, 0
%21 = zext i1 %20 to i32
%22 = add nuw nsw i32 %18, %21
%23 = mul nsw i32 %22, 100
%24 = mul nsw i32 %17, %11
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %16
%27 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %33
28: ; preds = %16
%29 = add nuw nsw i32 %17, 1
%30 = load i32, i32* @INT_MAX
%31 = sdiv i32 %30, 100
%32 = icmp slt i32 %29, %31
br i1 %32, label %16, label %33
33: ; preds = %28, %26, %8, %4
%34 = phi i32 [ 1, %4 ], [ 1, %8 ], [ 0, %26 ], [ 1, %28 ]
ret i32 %34
}