#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 *, ...);
int main(void) {
  float salario = 0.0;
  int horas_trabalhadas = 0;
  const int primeiras_horas = 40;
  printf("informe as horas trabalhadas: (-1 para terminar)\n");
  scanf("%d", &horas_trabalhadas);
  if ((horas_trabalhadas != -1) && (horas_trabalhadas <= 40)) {
    printf("digite o salario por hora do funcionario: \n");
    scanf("%f", &salario);
    printf("O valor do salario é: %.2f\n\n", horas_trabalhadas * salario);
  } else {
    if (horas_trabalhadas != -1) {
      printf("digite o salario por hora do funcionario : \n");
      scanf("%f", &salario);
      printf("O valor do salario é: %.2f\n\n",
             ((horas_trabalhadas - primeiras_horas) * salario * 0.5) +
                 (horas_trabalhadas * salario));
    }
  }
  while (horas_trabalhadas != -1) {
    printf("informe as horas trabalhadas: (-1 para terminar)\n");
    scanf("%d", &horas_trabalhadas);
    if ((horas_trabalhadas != -1) && (horas_trabalhadas <= 40)) {
      printf("digite o salario por hora do funcionario : \n");
      scanf("%f", &salario);
      printf("O valor do salario é: %.2f\n\n", horas_trabalhadas * salario);
    } else {
      if (horas_trabalhadas != -1) {
        printf("digite o salario por hora do funcionario : \n");
        scanf("%f", &salario);
        printf("O valor do salario é: %.2f\n\n",
               ((horas_trabalhadas - primeiras_horas) * salario * 0.5) +
                   (horas_trabalhadas * salario));
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x28,-0x10(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     11ba <main+0x9a>
cmpl   $0x28,-0xc(%rbp)
jg     11ba <main+0x9a>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cvtsi2ssl -0xc(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xebe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1228 <main+0x108>
cmpl   $0xffffffff,-0xc(%rbp)
je     1223 <main+0x103>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe90(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    $0x28,%eax
cvtsi2ss %eax,%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xdf3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
lea    0xe50(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1228 <main+0x108>
jmp    122d <main+0x10d>
cmpl   $0xffffffff,-0xc(%rbp)
je     131f <main+0x1ff>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdee(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     12ac <main+0x18c>
cmpl   $0x28,-0xc(%rbp)
jg     12ac <main+0x18c>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xde9(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cvtsi2ssl -0xc(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdcc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    131a <main+0x1fa>
cmpl   $0xffffffff,-0xc(%rbp)
je     1315 <main+0x1f5>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd9e(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    $0x28,%eax
cvtsi2ss %eax,%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xd01(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
lea    0xd5e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    131a <main+0x1fa>
jmp    122d <main+0x10d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeab(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rsp),%eax
cmp    $0xffffffff,%eax
je     11a4 <main+0x74>
cmp    $0x28,%eax
jg     11a4 <main+0x74>
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cvtsi2ssl (%rsp),%xmm0
mulss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
jmp    11ff <main+0xcf>
cmp    $0xffffffff,%eax
je     12f5 <main+0x1c5>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4b(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rsp),%eax
lea    -0x28(%rax),%ecx
cvtsi2ss %ecx,%xmm0
movss  0x4(%rsp),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2ss %eax,%xmm2
mulss  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
mulsd  0xe05(%rip),%xmm0
addsd  %xmm1,%xmm0
lea    0xe08(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmpl   $0xffffffff,(%rsp)
je     12f5 <main+0x1c5>
lea    0xdea(%rip),%r15
mov    %rsp,%r13
lea    0xe35(%rip),%r12
lea    0xddc(%rip),%rbx
lea    0x4(%rsp),%rbp
lea    0xdd3(%rip),%r14
jmp    1277 <main+0x147>
nopl   (%rax)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
cvtsi2ssl (%rsp),%xmm0
mulss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmpl   $0xffffffff,(%rsp)
je     12f5 <main+0x1c5>
lea    0xdae(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rsp),%eax
cmp    $0xffffffff,%eax
je     129d <main+0x16d>
cmp    $0x28,%eax
jle    1240 <main+0x110>
cmp    $0xffffffff,%eax
je     12f5 <main+0x1c5>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rsp),%eax
lea    -0x28(%rax),%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
movss  0x4(%rsp),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
cvtsi2ss %eax,%xmm2
mulss  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
mulsd  0xd14(%rip),%xmm0
addsd  %xmm1,%xmm0
jmp    1267 <main+0x137>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"informe as horas trabalhadas: (-1 para terminar)\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [44 x i8] c"digite o salario por hora do funcionario: \0A\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [30 x i8] c"O valor do salario \C3\A9: %.2f\0A\0A\00"
@.str.5 = [45 x i8] c"digite o salario por hora do funcionario : \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store i32 0, i32* %3
store i32 40, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %21
9: ; preds = %0
%10 = load i32, i32* %3
%11 = icmp sle i32 %10, 40
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to float
%17 = load float, float* %2
%18 = fmul float %16, %17
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %19)
br label %41
21: ; preds = %9, %0
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %40
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%27 = load i32, i32* %3
%28 = sub nsw i32 %27, 40
%29 = sitofp i32 %28 to float
%30 = load float, float* %2
%31 = fmul float %29, %30
%32 = fpext float %31 to double
%33 = load i32, i32* %3
%34 = sitofp i32 %33 to float
%35 = load float, float* %2
%36 = fmul float %34, %35
%37 = fpext float %36 to double
%38 = call double @llvm.fmuladd.f64(double %32, double 5.000000e-01, double %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %38)
br label %40
40: ; preds = %24, %21
br label %41
41: ; preds = %40, %12
br label %42
42: ; preds = %82, %41
%43 = load i32, i32* %3
%44 = icmp ne i32 %43, -1
br i1 %44, label %45, label %83
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%48 = load i32, i32* %3
%49 = icmp ne i32 %48, -1
br i1 %49, label %50, label %62
50: ; preds = %45
%51 = load i32, i32* %3
%52 = icmp sle i32 %51, 40
br i1 %52, label %53, label %62
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%55 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%56 = load i32, i32* %3
%57 = sitofp i32 %56 to float
%58 = load float, float* %2
%59 = fmul float %57, %58
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %60)
br label %82
62: ; preds = %50, %45
%63 = load i32, i32* %3
%64 = icmp ne i32 %63, -1
br i1 %64, label %65, label %81
65: ; preds = %62
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%67 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%68 = load i32, i32* %3
%69 = sub nsw i32 %68, 40
%70 = sitofp i32 %69 to float
%71 = load float, float* %2
%72 = fmul float %70, %71
%73 = fpext float %72 to double
%74 = load i32, i32* %3
%75 = sitofp i32 %74 to float
%76 = load float, float* %2
%77 = fmul float %75, %76
%78 = fpext float %77 to double
%79 = call double @llvm.fmuladd.f64(double %73, double 5.000000e-01, double %78)
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %79)
br label %81
81: ; preds = %65, %62
br label %82
82: ; preds = %81, %53
br label %42
83: ; preds = %42
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [30 x i8] c"O valor do salario \C3\A9: %.2f\0A\0A\00"
@str.6 = [49 x i8] c"informe as horas trabalhadas: (-1 para terminar)\00"
@str.9 = [44 x i8] c"digite o salario por hora do funcionario : \00"
@str.10 = [43 x i8] c"digite o salario por hora do funcionario: \00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.6, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, -1
%9 = icmp slt i32 %7, 41
%10 = and i1 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.10, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%14 = load i32, i32* %2
%15 = sitofp i32 %14 to float
%16 = load float, float* %1
%17 = fmul float %16, %15
%18 = fpext float %17 to double
br label %33
19: ; preds = %0
br i1 %8, label %20, label %72
20: ; preds = %19
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.9, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%23 = load i32, i32* %2
%24 = add nsw i32 %23, -40
%25 = sitofp i32 %24 to float
%26 = load float, float* %1
%27 = fmul float %26, %25
%28 = fpext float %27 to double
%29 = sitofp i32 %23 to float
%30 = fmul float %26, %29
%31 = fpext float %30 to double
%32 = call double @llvm.fmuladd.f64(double %28, double 5.000000e-01, double %31)
br label %33
33: ; preds = %20, %11
%34 = phi double [ %32, %20 ], [ %18, %11 ]
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %34)
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, -1
br i1 %37, label %72, label %38
38: ; preds = %33, %67
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.6, i64 0, i64 0))
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%41 = load i32, i32* %2
%42 = icmp ne i32 %41, -1
%43 = icmp slt i32 %41, 41
%44 = and i1 %42, %43
br i1 %44, label %45, label %53
45: ; preds = %38
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.9, i64 0, i64 0))
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%48 = load i32, i32* %2
%49 = sitofp i32 %48 to float
%50 = load float, float* %1
%51 = fmul float %50, %49
%52 = fpext float %51 to double
br label %67
53: ; preds = %38
br i1 %42, label %54, label %72
54: ; preds = %53
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.9, i64 0, i64 0))
%56 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%57 = load i32, i32* %2
%58 = add nsw i32 %57, -40
%59 = sitofp i32 %58 to float
%60 = load float, float* %1
%61 = fmul float %60, %59
%62 = fpext float %61 to double
%63 = sitofp i32 %57 to float
%64 = fmul float %60, %63
%65 = fpext float %64 to double
%66 = call double @llvm.fmuladd.f64(double %62, double 5.000000e-01, double %65)
br label %67
67: ; preds = %54, %45
%68 = phi double [ %66, %54 ], [ %52, %45 ]
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %68)
%70 = load i32, i32* %2
%71 = icmp eq i32 %70, -1
br i1 %71, label %72, label %38
72: ; preds = %53, %67, %19, %33
ret i32 0
}