#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 div2(int);
int power3(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num, temp, result;
  int count = -1;
  int pos = 0;
  printf("input numbers?\n");
  scanf("%d", &num);
  while (count < num) {
    pos++;
    temp = div2(pos);
    result = power3(temp);
    if (result == 1)
      count++;
  }
  printf("answer=%d\n", pos);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11be <main+0x7e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <div2@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <power3@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11b9 <main+0x79>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117b <main+0x3b>
mov    -0x18(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9a(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
js     11a3 <main+0x53>
mov    $0xffffffff,%ebp
xor    %ebx,%ebx
xchg   %ax,%ax
add    $0x1,%ebx
mov    %ebx,%edi
call   1040 <div2@plt>
mov    %eax,%edi
call   1070 <power3@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebp
cmp    0x4(%rsp),%ebp
jl     1180 <main+0x30>
jmp    11a5 <main+0x55>
xor    %ebx,%ebx
lea    0xe57(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"input numbers?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"answer=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %5
store i32 0, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %25, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %26
13: ; preds = %9
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 1
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = call i32 @div2(i32 %16)
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = call i32 @power3(i32 %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %13
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %25
25: ; preds = %22, %13
br label %9
26: ; preds = %9
%27 = load i32, i32* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"answer=%d\0A\00"
@str = [15 x i8] c"input numbers?\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, -1
br i1 %6, label %7, label %18
7: ; preds = %0, %7
%8 = phi i32 [ %10, %7 ], [ 0, %0 ]
%9 = phi i32 [ %15, %7 ], [ -1, %0 ]
%10 = add nuw nsw i32 %8, 1
%11 = call i32 @div2(i32 %10)
%12 = call i32 @power3(i32 %11)
%13 = icmp eq i32 %12, 1
%14 = zext i1 %13 to i32
%15 = add nsw i32 %9, %14
%16 = load i32, i32* %1
%17 = icmp slt i32 %15, %16
br i1 %17, label %7, label %18
18: ; preds = %7, %0
%19 = phi i32 [ 0, %0 ], [ %10, %7 ]
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %19)
ret i32 0
}