#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 ex7() {
  float salario;
  printf("Informe o salario: ");
  scanf("%f", &salario);
  float auxesc = 250, extra;
  if (salario > 1500)
    extra = 0;
  else if (salario > 1000)
    extra = 0.1 * salario;
  else
    extra = 0.15 * salario;
  if (salario > 800)
    auxesc -= 50;
  float total = salario + extra + auxesc;
  printf("Salario:\n");
  printf("\tInicial:\tR$%.2f", salario);
  printf("\tBonificacao:\tR$%.2f", extra);
  printf("\tAux.Escola:\tR$%.2f", auxesc);
  printf("\tTotal:\t\tR$%.2f", total);
}


x86 assembly (clang, -O0):
<ex7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xeb6(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xea0(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1176 <ex7+0x56>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11d2 <ex7+0xb2>
movss  -0x4(%rbp),%xmm0
movss  0xe85(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11af <ex7+0x8f>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe83(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11cd <ex7+0xad>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe58(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11d2 <ex7+0xb2>
movss  -0x4(%rbp),%xmm0
movss  0xe2d(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11fe <ex7+0xde>
movss  -0x8(%rbp),%xmm0
movss  0xe1b(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe19(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe13(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe11(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex7>:
sub    $0x18,%rsp
lea    0xeed(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef3(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
ucomiss 0xe9d(%rip),%xmm1
ja     118b <ex7+0x5b>
ucomiss 0xe98(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jbe    117f <ex7+0x4f>
mulsd  0xe9b(%rip),%xmm0
jmp    1187 <ex7+0x57>
mulsd  0xe89(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
ucomiss 0xe6e(%rip),%xmm1
seta   %al
lea    0xe7c(%rip),%rcx
movss  (%rcx,%rax,4),%xmm2
movss  %xmm2,0x10(%rsp)
addss  %xmm0,%xmm1
addss  %xmm2,%xmm1
movss  %xmm1,0x14(%rsp)
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe57(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Informe o salario: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [10 x i8] c"Salario:\0A\00"
@.str.3 = [17 x i8] c"\09Inicial:\09R$%.2f\00"
@.str.4 = [21 x i8] c"\09Bonificacao:\09R$%.2f\00"
@.str.5 = [20 x i8] c"\09Aux.Escola:\09R$%.2f\00"
@.str.6 = [16 x i8] c"\09Total:\09\09R$%.2f\00"
define void @ex7() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
store float 2.500000e+02, float* %2
%7 = load float, float* %1
%8 = fcmp ogt float %7, 1.500000e+03
br i1 %8, label %9, label %10
9: ; preds = %0
store float 0.000000e+00, float* %3
br label %24
10: ; preds = %0
%11 = load float, float* %1
%12 = fcmp ogt float %11, 1.000000e+03
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load float, float* %1
%15 = fpext float %14 to double
%16 = fmul double 1.000000e-01, %15
%17 = fptrunc double %16 to float
store float %17, float* %3
br label %23
18: ; preds = %10
%19 = load float, float* %1
%20 = fpext float %19 to double
%21 = fmul double 1.500000e-01, %20
%22 = fptrunc double %21 to float
store float %22, float* %3
br label %23
23: ; preds = %18, %13
br label %24
24: ; preds = %23, %9
%25 = load float, float* %1
%26 = fcmp ogt float %25, 8.000000e+02
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load float, float* %2
%29 = fsub float %28, 5.000000e+01
store float %29, float* %2
br label %30
30: ; preds = %27, %24
%31 = load float, float* %1
%32 = load float, float* %3
%33 = fadd float %31, %32
%34 = load float, float* %2
%35 = fadd float %33, %34
store float %35, float* %4
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%37 = load float, float* %1
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %38)
%40 = load float, float* %3
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %41)
%43 = load float, float* %2
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %44)
%46 = load float, float* %4
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %47)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Informe o salario: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [17 x i8] c"\09Inicial:\09R$%.2f\00"
@.str.4 = [21 x i8] c"\09Bonificacao:\09R$%.2f\00"
@.str.5 = [20 x i8] c"\09Aux.Escola:\09R$%.2f\00"
@.str.6 = [16 x i8] c"\09Total:\09\09R$%.2f\00"
@str = [9 x i8] c"Salario:\00"
define void @ex7() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 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, 1.500000e+03
br i1 %6, label %16, label %7
7: ; preds = %0
%8 = fcmp ogt float %5, 1.000000e+03
%9 = fpext float %5 to double
br i1 %8, label %10, label %13
10: ; preds = %7
%11 = fmul double %9, 1.000000e-01
%12 = fptrunc double %11 to float
br label %16
13: ; preds = %7
%14 = fmul double %9, 1.500000e-01
%15 = fptrunc double %14 to float
br label %16
16: ; preds = %0, %10, %13
%17 = phi float [ %12, %10 ], [ %15, %13 ], [ 0.000000e+00, %0 ]
%18 = fcmp ogt float %5, 8.000000e+02
%19 = select i1 %18, float 2.000000e+02, float 2.500000e+02
%20 = fadd float %5, %17
%21 = fadd float %19, %20
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%23 = load float, float* %1
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %24)
%26 = fpext float %17 to double
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %26)
%28 = fpext float %19 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %28)
%30 = fpext float %21 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %30)
ret void
}