#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 *, float *);
int sin(float);
int sqrt(float);
int main() {
  float x, y;
  printf("Please input the value of x:\n");
  scanf("%f", &x);
  if (x < 6)
    y = 1 + x;
  else if (x >= 10)
    y = sin(x) + 2 * x;
  else
    y = sqrt(x - 2) + 1;
  printf("f(%.2f)=%.2f\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  0xe8d(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1194 <main+0x54>
movss  0xe87(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11f6 <main+0xb6>
movss  -0x8(%rbp),%xmm0
movss  0xe63(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11cf <main+0x8f>
movss  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
cvtsi2ss %eax,%xmm1
movss  -0x8(%rbp),%xmm0
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11f1 <main+0xb1>
movss  -0x8(%rbp),%xmm0
movss  0xe2c(%rip),%xmm1
subss  %xmm1,%xmm0
call   1060 <sqrt@plt>
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11f6 <main+0xb6>
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0xe84(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     119e <main+0x4e>
ucomiss 0xe7c(%rip),%xmm0
jae    1199 <main+0x49>
addss  0xe76(%rip),%xmm0
call   1070 <sqrt@plt>
jmp    119e <main+0x4e>
call   1050 <sin@plt>
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Please input the value of x:\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"f(%.2f)=%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 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), float* %2)
%6 = load float, float* %2
%7 = fcmp olt float %6, 6.000000e+00
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load float, float* %2
%10 = fadd float 1.000000e+00, %9
store float %10, float* %3
br label %27
11: ; preds = %0
%12 = load float, float* %2
%13 = fcmp oge float %12, 1.000000e+01
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load float, float* %2
%16 = call i32 @sin(float %15)
%17 = sitofp i32 %16 to float
%18 = load float, float* %2
%19 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %18, float %17)
store float %19, float* %3
br label %26
20: ; preds = %11
%21 = load float, float* %2
%22 = fsub float %21, 2.000000e+00
%23 = call i32 @sqrt(float %22)
%24 = add nsw i32 %23, 1
%25 = sitofp i32 %24 to float
store float %25, float* %3
br label %26
26: ; preds = %20, %14
br label %27
27: ; preds = %26, %8
%28 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"f(%.2f)=%.2f\0A\00"
@str = [29 x i8] c"Please input the value of x:\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 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), float* %1)
%5 = load float, float* %1
%6 = fcmp olt float %5, 6.000000e+00
br i1 %6, label %14, label %7
7: ; preds = %0
%8 = fcmp ult float %5, 1.000000e+01
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = call i32 @sin(float %5)
br label %14
11: ; preds = %7
%12 = fadd float %5, -2.000000e+00
%13 = call i32 @sqrt(float %12)
br label %14
14: ; preds = %0, %9, %11
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}