#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 */
float cos(float);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, float *);
float sin(float);
int main() {
  float x, y;
  printf("Please input the value of x:\n");
  scanf("%f", &x);
  if (x < 5)
    y = 0;
  else if (x > 10)
    y = sin(x) + cos(x);
  else
    y = sin(x);
  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    0xeb2(%rip),%rdi
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  0xe8d(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    118a <main+0x4a>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11e3 <main+0xa3>
movss  -0x8(%rbp),%xmm0
movss  0xe6d(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11cf <main+0x8f>
movss  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11de <main+0x9e>
movss  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0xc(%rbp)
jmp    11e3 <main+0xa3>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0xe84(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     11bc <main+0x6c>
movss  0xe7b(%rip),%xmm1
ucomiss %xmm0,%xmm1
setae  %cl
ucomiss 0xe72(%rip),%xmm0
setae  %al
or     %cl,%al
ucomiss 0xe6a(%rip),%xmm0
jbe    11b8 <main+0x68>
test   %al,%al
jne    11cc <main+0x7c>
ucomiss 0xe59(%rip),%xmm0
jae    11e8 <main+0x98>
ucomiss %xmm0,%xmm1
jb     11bc <main+0x6c>
jmp    11e8 <main+0x98>
test   %al,%al
jne    11ef <main+0x9f>
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
call   1050 <sin@plt>
movss  0xe2b(%rip),%xmm1
movss  0x4(%rsp),%xmm0
ucomiss 0xe22(%rip),%xmm0
jb     11b1 <main+0x61>
call   1070 <cos@plt>
jmp    11bc <main+0x6c>
call   1050 <sin@plt>
jmp    11bc <main+0x6c>

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, 5.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %0
store float 0.000000e+00, float* %3
br label %22
9: ; preds = %0
%10 = load float, float* %2
%11 = fcmp ogt float %10, 1.000000e+01
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load float, float* %2
%14 = call float @sin(float %13)
%15 = load float, float* %2
%16 = call float @cos(float %15)
%17 = fadd float %14, %16
store float %17, float* %3
br label %21
18: ; preds = %9
%19 = load float, float* %2
%20 = call float @sin(float %19)
store float %20, float* %3
br label %21
21: ; preds = %18, %12
br label %22
22: ; preds = %21, %8
%23 = 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, 5.000000e+00
br i1 %6, label %26, label %7
7: ; preds = %0
%8 = fcmp ogt float %5, 1.000000e+01
%9 = fcmp oeq float %5, 0xFFF0000000000000
%10 = fcmp oeq float %5, 0x7FF0000000000000
%11 = or i1 %10, %9
br i1 %8, label %12, label %23
12: ; preds = %7
br i1 %11, label %13, label %16
13: ; preds = %12
%14 = call float @sin(float %5)
%15 = load float, float* %1
br label %16
16: ; preds = %12, %13
%17 = phi float [ %5, %12 ], [ %15, %13 ]
%18 = fcmp oeq float %17, 0xFFF0000000000000
%19 = fcmp oeq float %17, 0x7FF0000000000000
%20 = or i1 %19, %18
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = call float @cos(float %17)
br label %26
23: ; preds = %7
br i1 %11, label %24, label %26
24: ; preds = %23
%25 = call float @sin(float %5)
br label %26
26: ; preds = %24, %23, %21, %16, %0
%27 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}