#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 main(void) {
  float saldoM, credito;
  printf("Insira o Saldo Medio: ");
  scanf("%i", &saldoM);
  credito = 0;
  if (saldoM < 2000)
    credito = 0.1 * saldoM;
  if (saldoM < 3000)
    credito = 0.2 * saldoM;
  if (saldoM < 4000)
    credito = 0.25 * saldoM;
  printf("Com %.2f de saldo, seu credito eh: %.2f", saldoM, credito);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xeaa(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    117e <main+0x5e>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe9f(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe7e(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    11ae <main+0x8e>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe77(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe52(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    11de <main+0xbe>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe4f(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe4b(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm0
movsd  0xeae(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsd2ss %xmm2,%xmm2
movaps %xmm1,%xmm3
cmpltss 0xeaa(%rip),%xmm3
movsd  0xe9a(%rip),%xmm4
mulsd  %xmm0,%xmm4
cvtsd2ss %xmm4,%xmm4
movaps %xmm1,%xmm5
cmpltss 0xe92(%rip),%xmm5
andps  %xmm2,%xmm3
andps  %xmm5,%xmm4
andnps %xmm3,%xmm5
orps   %xmm4,%xmm5
movss  0xe82(%rip),%xmm2
mulss  %xmm1,%xmm2
cmpltss 0xe79(%rip),%xmm1
movaps %xmm1,%xmm3
andnps %xmm5,%xmm3
andps  %xmm2,%xmm1
orps   %xmm3,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe80(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Insira o Saldo Medio: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [40 x i8] c"Com %.2f de saldo, seu credito eh: %.2f\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 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)
store float 0.000000e+00, float* %2
%5 = load float, float* %1
%6 = fcmp olt float %5, 2.000000e+03
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = load float, float* %1
%9 = fpext float %8 to double
%10 = fmul double 1.000000e-01, %9
%11 = fptrunc double %10 to float
store float %11, float* %2
br label %12
12: ; preds = %7, %0
%13 = load float, float* %1
%14 = fcmp olt float %13, 3.000000e+03
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load float, float* %1
%17 = fpext float %16 to double
%18 = fmul double 2.000000e-01, %17
%19 = fptrunc double %18 to float
store float %19, float* %2
br label %20
20: ; preds = %15, %12
%21 = load float, float* %1
%22 = fcmp olt float %21, 4.000000e+03
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load float, float* %1
%25 = fpext float %24 to double
%26 = fmul double 2.500000e-01, %25
%27 = fptrunc double %26 to float
store float %27, float* %2
br label %28
28: ; preds = %23, %20
%29 = load float, float* %1
%30 = fpext float %29 to double
%31 = load float, float* %2
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), double %30, double %32)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Insira o Saldo Medio: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [40 x i8] c"Com %.2f de saldo, seu credito eh: %.2f\00"
define void @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 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, 2.000000e+03
%7 = fpext float %5 to double
%8 = fmul double %7, 1.000000e-01
%9 = fptrunc double %8 to float
%10 = select i1 %6, float %9, float 0.000000e+00
%11 = fcmp olt float %5, 3.000000e+03
%12 = fmul double %7, 2.000000e-01
%13 = fptrunc double %12 to float
%14 = select i1 %11, float %13, float %10
%15 = fcmp olt float %5, 4.000000e+03
%16 = fmul float %5, 2.500000e-01
%17 = select i1 %15, float %16, float %14
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), double %7, double %18)
ret void
}