#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*/ fpurge(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdin;
int main() {
  int number;
  float iq;
  char first;
  puts("IQ Calculator\n");
  printf("Enter your house or apartment number:");
  scanf("%d", &number);
  fpurge(stdin);
  printf("Enter the first letter of your last name:");
  scanf("%c", &first);
  puts("\n\n\tCalculating your IQ.... \n\t\t......");
  iq = (float)number / first;
  if (iq <= 50)
    iq = iq * 2;
  if (iq > 50 && iq < 80)
    iq = iq + 50;
  printf("Your IQ is probably ... %f\r", iq);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1060 <fpurge@plt>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0xd(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
movsbl -0xd(%rbp),%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe2d(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     11ef <main+0xaf>
movss  0xe1f(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe04(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1229 <main+0xe9>
movss  0xdfb(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1229 <main+0xe9>
movss  0xde1(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
call   1060 <fpurge@plt>
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
cvtsi2ssl 0x4(%rsp),%xmm0
movsbl 0x3(%rsp),%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movaps %xmm0,%xmm1
addss  %xmm0,%xmm1
movss  0xe35(%rip),%xmm2
movaps %xmm0,%xmm3
cmpnless %xmm2,%xmm3
andps  %xmm3,%xmm0
andnps %xmm1,%xmm3
orps   %xmm0,%xmm3
movaps %xmm3,%xmm0
addss  %xmm2,%xmm0
movaps %xmm3,%xmm1
cmpltss 0xe15(%rip),%xmm1
cmpltss %xmm3,%xmm2
andps  %xmm1,%xmm0
andnps %xmm3,%xmm1
orps   %xmm0,%xmm1
andps  %xmm2,%xmm1
andnps %xmm3,%xmm2
orps   %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
lea    0xe7e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"IQ Calculator\0A\00"
@.str.1 = [38 x i8] c"Enter your house or apartment number:\00"
@.str.2 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.3 = [42 x i8] c"Enter the first letter of your last name:\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [37 x i8] c"\0A\0A\09Calculating your IQ.... \0A\09\09......\00"
@.str.6 = [28 x i8] c"Your IQ is probably ... %f\0D\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%8 = load i32, i32* @stdin
%9 = call i32 @fpurge(i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%12 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = sitofp i32 %13 to float
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = sitofp i32 %16 to float
%18 = fdiv float %14, %17
store float %18, float* %3
%19 = load float, float* %3
%20 = fcmp ole float %19, 5.000000e+01
br i1 %20, label %21, label %24
21: ; preds = %0
%22 = load float, float* %3
%23 = fmul float %22, 2.000000e+00
store float %23, float* %3
br label %24
24: ; preds = %21, %0
%25 = load float, float* %3
%26 = fcmp ogt float %25, 5.000000e+01
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load float, float* %3
%29 = fcmp olt float %28, 8.000000e+01
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load float, float* %3
%32 = fadd float %31, 5.000000e+01
store float %32, float* %3
br label %33
33: ; preds = %30, %27, %24
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"IQ Calculator\0A\00"
@.str.1 = [38 x i8] c"Enter your house or apartment number:\00"
@.str.2 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.3 = [42 x i8] c"Enter the first letter of your last name:\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [37 x i8] c"\0A\0A\09Calculating your IQ.... \0A\09\09......\00"
@.str.6 = [28 x i8] c"Your IQ is probably ... %f\0D\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* @stdin
%8 = call i32 @fpurge(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = sitofp i32 %12 to float
%14 = load i8, i8* %2
%15 = sitofp i8 %14 to float
%16 = fdiv float %13, %15
%17 = fcmp ugt float %16, 5.000000e+01
%18 = fmul float %16, 2.000000e+00
%19 = select i1 %17, float %16, float %18
%20 = fcmp ogt float %19, 5.000000e+01
%21 = fcmp olt float %19, 8.000000e+01
%22 = and i1 %20, %21
%23 = fadd float %19, 5.000000e+01
%24 = select i1 %22, float %23, float %19
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double %25)
ret i32 0
}