#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 ex2() {
  float phora, horas;
  printf("Informe o valor recebido por hora de trabalho: ");
  scanf("%f", &phora);
  printf("Informe a quantidade de horas trabalhadas da semana: ");
  scanf("%f", &horas);
  float snormal = phora * horas, sextra = 0;
  if (horas > 40)
    sextra = phora * (horas - 40) * 0.5;
  float sbruto = snormal + sextra;
  printf("Salario:\n\tNormal: R$%.2f\n\tExtra: R$%.2f\n\tBruto: R$%.2f\n",
         snormal, sextra, sbruto);
}


x86 assembly (clang, -O0):
<ex2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf03(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe78(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11c4 <ex2+0xa4>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xe5d(%rip),%xmm2
subss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe51(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x14(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe84(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex2>:
push   %rbx
sub    $0x10,%rsp
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf02(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xef1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movss  0xe8a(%rip),%xmm2
addss  %xmm1,%xmm2
mulss  %xmm0,%xmm2
movaps %xmm0,%xmm3
mulss  0xe7b(%rip),%xmm2
mulss  %xmm1,%xmm3
movss  0xe73(%rip),%xmm4
cmpltss %xmm1,%xmm4
andps  %xmm2,%xmm4
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
addss  %xmm4,%xmm3
xorps  %xmm1,%xmm1
cvtss2sd %xmm4,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
lea    0xeb8(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Informe o valor recebido por hora de trabalho: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [54 x i8] c"Informe a quantidade de horas trabalhadas da semana: \00"
@.str.3 = [56 x i8] c"Salario:\0A\09Normal: R$%.2f\0A\09Extra: R$%.2f\0A\09Bruto: R$%.2f\0A\00"
define void @ex2() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%10 = load float, float* %1
%11 = load float, float* %2
%12 = fmul float %10, %11
store float %12, float* %3
store float 0.000000e+00, float* %4
%13 = load float, float* %2
%14 = fcmp ogt float %13, 4.000000e+01
br i1 %14, label %15, label %23
15: ; preds = %0
%16 = load float, float* %1
%17 = load float, float* %2
%18 = fsub float %17, 4.000000e+01
%19 = fmul float %16, %18
%20 = fpext float %19 to double
%21 = fmul double %20, 5.000000e-01
%22 = fptrunc double %21 to float
store float %22, float* %4
br label %23
23: ; preds = %15, %0
%24 = load float, float* %3
%25 = load float, float* %4
%26 = fadd float %24, %25
store float %26, float* %5
%27 = load float, float* %3
%28 = fpext float %27 to double
%29 = load float, float* %4
%30 = fpext float %29 to double
%31 = load float, float* %5
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), double %28, double %30, double %32)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"Informe o valor recebido por hora de trabalho: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [54 x i8] c"Informe a quantidade de horas trabalhadas da semana: \00"
@.str.3 = [56 x i8] c"Salario:\0A\09Normal: R$%.2f\0A\09Extra: R$%.2f\0A\09Bruto: R$%.2f\0A\00"
define void @ex2() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 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)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = load float, float* %1
%10 = load float, float* %2
%11 = fmul float %9, %10
%12 = fcmp ogt float %10, 4.000000e+01
%13 = fadd float %10, -4.000000e+01
%14 = fmul float %9, %13
%15 = fmul float %14, 5.000000e-01
%16 = select i1 %12, float %15, float 0.000000e+00
%17 = fadd float %11, %16
%18 = fpext float %11 to double
%19 = fpext float %16 to double
%20 = fpext float %17 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), double %18, double %19, double %20)
ret void
}