#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void checkGoldenRatio() {
  int input1, input2, output;
  printf("Enter Number\n\n>>");
  scanf("%d", &input1);
  printf("Enter Number \n\n>>");
  scanf("%d", &input2);
  if (input2 > input1) {
    printf("Invalid!!\n\n");
  } else {
    output = input1 / input2;
    if (output > 1.68 && output < 1.69) {
      printf("Golden Ratio Exists\n\n");
    } else {
      printf("Golden Ratio doesn't exist \n\n");
    }
  }
}


x86 assembly (clang, -O0):
<checkGoldenRatio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    117d <checkGoldenRatio+0x5d>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    11d7 <checkGoldenRatio+0xb7>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe6c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c6 <checkGoldenRatio+0xa6>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe5d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c6 <checkGoldenRatio+0xa6>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
jmp    11d2 <checkGoldenRatio+0xb2>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    11d7 <checkGoldenRatio+0xb7>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkGoldenRatio>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xec9(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    0xc(%rsp),%eax
lea    0xec6(%rip),%rax
lea    0xea2(%rip),%rdi
cmovg  %rax,%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter Number\0A\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Enter Number \0A\0A>>\00"
@.str.3 = [12 x i8] c"Invalid!!\0A\0A\00"
@.str.4 = [22 x i8] c"Golden Ratio Exists\0A\0A\00"
@.str.5 = [30 x i8] c"Golden Ratio doesn't exist \0A\0A\00"
define void @checkGoldenRatio() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %29
13: ; preds = %0
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = sdiv i32 %14, %15
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = sitofp i32 %17 to double
%19 = fcmp ogt double %18, 1.680000e+00
br i1 %19, label %20, label %26
20: ; preds = %13
%21 = load i32, i32* %3
%22 = sitofp i32 %21 to double
%23 = fcmp olt double %22, 1.690000e+00
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %28
26: ; preds = %20, %13
%27 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
br label %29
29: ; preds = %28, %11
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter Number\0A\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Enter Number \0A\0A>>\00"
@str = [29 x i8] c"Golden Ratio doesn't exist \0A\00"
@str.7 = [11 x i8] c"Invalid!!\0A\00"
define void @checkGoldenRatio() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, 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)
%9 = load i32, i32* %2
%10 = load i32, i32* %1
%11 = icmp sgt i32 %9, %10
%12 = select i1 %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0)
%13 = call i32 @puts(i8* dereferenceable(1) %12)
ret void
}