#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) {
  int nh;
  float sph, sal, x, vhe;
  nh = 0;
  printf("\nDigite o número de horas trabalhadas (-1 para finalizar): ");
  scanf("%d", &nh);
  while (nh != -1) {
    printf("Digite o salário por hora do funcionário: ");
    scanf("%f", &sph);
    if (nh <= 40) {
      sal = nh * sph;
    } else {
      x = 40 * sph;
      vhe = (nh - 40) * sph * 1.5;
      sal = x + vhe;
    }
    printf("O salário é de R$ %.2f\n\n", sal);
    printf("\nDigite o número de horas trabalhadas (-1 para finalizar): ");
    scanf("%d", &nh);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
je     1223 <main+0x103>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x28,-0x8(%rbp)
jg     119e <main+0x7e>
cvtsi2ssl -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11e7 <main+0xc7>
movss  0xe62(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x28,%eax
cvtsi2ss %eax,%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe35(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe85(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe36(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    1156 <main+0x36>
xor    %eax,%eax
add    $0x20,%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,(%rsp)
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0xffffffff,(%rsp)
je     1215 <main+0xf5>
lea    0xf13(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xf0a(%rip),%r13
lea    0xe93(%rip),%rbx
lea    0xec9(%rip),%rbp
mov    %rsp,%r14
jmp    11e3 <main+0xc3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  0x4(%rsp),%xmm1
add    $0xffffffd8,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm1,%xmm0
mulss  0xe54(%rip),%xmm1
mulss  0xe50(%rip),%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0xffffffff,(%rsp)
je     1215 <main+0xf5>
lea    0xe5e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    (%rsp),%eax
cmp    $0x28,%eax
jg     1190 <main+0x70>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x4(%rsp),%xmm0
jmp    11b8 <main+0x98>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [61 x i8] c"\0ADigite o n\C3\BAmero de horas trabalhadas (-1 para finalizar): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [45 x i8] c"Digite o sal\C3\A1rio por hora do funcion\C3\A1rio: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [27 x i8] c"O sal\C3\A1rio \C3\A9 de R$ %.2f\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %36, %0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %42
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 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* %3)
%15 = load i32, i32* %2
%16 = icmp sle i32 %15, 40
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to float
%20 = load float, float* %3
%21 = fmul float %19, %20
store float %21, float* %4
br label %36
22: ; preds = %12
%23 = load float, float* %3
%24 = fmul float 4.000000e+01, %23
store float %24, float* %5
%25 = load i32, i32* %2
%26 = sub nsw i32 %25, 40
%27 = sitofp i32 %26 to float
%28 = load float, float* %3
%29 = fmul float %27, %28
%30 = fpext float %29 to double
%31 = fmul double %30, 1.500000e+00
%32 = fptrunc double %31 to float
store float %32, float* %6
%33 = load float, float* %5
%34 = load float, float* %6
%35 = fadd float %33, %34
store float %35, float* %4
br label %36
36: ; preds = %22, %17
%37 = load float, float* %4
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%41 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %9
42: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [61 x i8] c"\0ADigite o n\C3\BAmero de horas trabalhadas (-1 para finalizar): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [45 x i8] c"Digite o sal\C3\A1rio por hora do funcion\C3\A1rio: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [27 x i8] c"O sal\C3\A1rio \C3\A9 de R$ %.2f\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
%4 = bitcast float* %2 to i8*
store i32 0, i32* %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 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* %1)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, -1
br i1 %8, label %34, label %9
9: ; preds = %0, %26
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%12 = load i32, i32* %1
%13 = icmp slt i32 %12, 41
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = sitofp i32 %12 to float
%16 = load float, float* %2
%17 = fmul float %16, %15
br label %26
18: ; preds = %9
%19 = load float, float* %2
%20 = fmul float %19, 4.000000e+01
%21 = add nsw i32 %12, -40
%22 = sitofp i32 %21 to float
%23 = fmul float %19, %22
%24 = fmul float %23, 1.500000e+00
%25 = fadd float %20, %24
br label %26
26: ; preds = %18, %14
%27 = phi float [ %17, %14 ], [ %25, %18 ]
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%32 = load i32, i32* %1
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %9
34: ; preds = %26, %0
ret i32 0
}