#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 *);
void ex1() {
  float compra;
  printf("Informe o valor da compra: ");
  scanf("%f", &compra);
  float total;
  if (compra > 200)
    total = 0.8 * compra;
  else if (compra > 100)
    total = 0.9 * compra;
  else
    total = 0.95 * compra;
  printf("Valor total: R$%.2f\n", total);
}


x86 assembly (clang, -O0):
<ex1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
movss  0xead(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    117f <ex1+0x5f>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeab(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11db <ex1+0xbb>
movss  -0x4(%rbp),%xmm0
movss  0xe78(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11b8 <ex1+0x98>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe6a(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11d6 <ex1+0xb6>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe3f(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11db <ex1+0xbb>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe54(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex1>:
push   %rax
lea    0xef8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf06(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xeb3(%rip),%xmm0
jbe    115d <ex1+0x3d>
cvtss2sd %xmm0,%xmm0
mulsd  0xebd(%rip),%xmm0
jmp    117c <ex1+0x5c>
ucomiss 0xea0(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
jbe    1174 <ex1+0x54>
mulsd  0xe9e(%rip),%xmm0
jmp    117c <ex1+0x5c>
mulsd  0xe8c(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Informe o valor da compra: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [21 x i8] c"Valor total: R$%.2f\0A\00"
define void @ex1() {
%1 = alloca float
%2 = alloca float
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 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 ogt float %5, 2.000000e+02
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = load float, float* %1
%9 = fpext float %8 to double
%10 = fmul double 8.000000e-01, %9
%11 = fptrunc double %10 to float
store float %11, float* %2
br label %26
12: ; preds = %0
%13 = load float, float* %1
%14 = fcmp ogt float %13, 1.000000e+02
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load float, float* %1
%17 = fpext float %16 to double
%18 = fmul double 9.000000e-01, %17
%19 = fptrunc double %18 to float
store float %19, float* %2
br label %25
20: ; preds = %12
%21 = load float, float* %1
%22 = fpext float %21 to double
%23 = fmul double 0x3FEE666666666666, %22
%24 = fptrunc double %23 to float
store float %24, float* %2
br label %25
25: ; preds = %20, %15
br label %26
26: ; preds = %25, %7
%27 = load float, float* %2
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %28)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Informe o valor da compra: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [21 x i8] c"Valor total: R$%.2f\0A\00"
define void @ex1() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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 ogt float %5, 2.000000e+02
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = fpext float %5 to double
%9 = fmul double %8, 8.000000e-01
br label %17
10: ; preds = %0
%11 = fcmp ogt float %5, 1.000000e+02
%12 = fpext float %5 to double
br i1 %11, label %13, label %15
13: ; preds = %10
%14 = fmul double %12, 9.000000e-01
br label %17
15: ; preds = %10
%16 = fmul double %12, 0x3FEE666666666666
br label %17
17: ; preds = %13, %15, %7
%18 = phi double [ %9, %7 ], [ %14, %13 ], [ %16, %15 ]
%19 = fptrunc double %18 to float
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %20)
ret void
}