#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 *);
void ex6() {
  float smin = 730;
  int pecas;
  printf("Informe a quantidade de pecas montadas no mes: ");
  scanf("%d", &pecas);
  float comissao = 0, sbruto;
  if (pecas > 35)
    comissao += (pecas - 30) * 0.5 * smin;
  else if (pecas > 30)
    comissao += (pecas - 30) * 0.3 * smin;
  sbruto = smin + comissao;
  printf("Salario:\n");
  printf("\tMinimo:\tR$%.2f", smin);
  printf("\tComissao:\tR$%.2f", comissao);
  printf("\tBruto:\tR$%.2f", sbruto);
}


x86 assembly (clang, -O0):
<ex6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xed0(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
cmpl   $0x23,-0x8(%rbp)
jle    11a3 <ex6+0x83>
mov    -0x8(%rbp),%eax
sub    $0x1e,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe99(%rip),%xmm1
mulsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11eb <ex6+0xcb>
cmpl   $0x1e,-0x8(%rbp)
jle    11e6 <ex6+0xc6>
mov    -0x8(%rbp),%eax
sub    $0x1e,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe49(%rip),%xmm1
mulsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11eb <ex6+0xcb>
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe36(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe31(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex6>:
sub    $0x18,%rsp
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf03(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x24,%eax
jl     116d <ex6+0x3d>
add    $0xffffffe2,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xea5(%rip),%xmm0
jmp    1187 <ex6+0x57>
xorps  %xmm0,%xmm0
cmp    $0x1f,%eax
jl     119e <ex6+0x6e>
add    $0xffffffe2,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe79(%rip),%xmm0
mulsd  0xe79(%rip),%xmm0
xorpd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
movss  0xe6c(%rip),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
lea    0xe86(%rip),%rdi
movsd  0xe37(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe70(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Informe a quantidade de pecas montadas no mes: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"Salario:\0A\00"
@.str.3 = [16 x i8] c"\09Minimo:\09R$%.2f\00"
@.str.4 = [18 x i8] c"\09Comissao:\09R$%.2f\00"
@.str.5 = [15 x i8] c"\09Bruto:\09R$%.2f\00"
define void @ex6() {
%1 = alloca float
%2 = alloca i32
%3 = alloca float
%4 = alloca float
store float 7.300000e+02, float* %1
%5 = call i32 (i8*, ...) @printf(i8* 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), i32* %2)
store float 0.000000e+00, float* %3
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 35
br i1 %8, label %9, label %20
9: ; preds = %0
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 30
%12 = sitofp i32 %11 to double
%13 = fmul double %12, 5.000000e-01
%14 = load float, float* %1
%15 = fpext float %14 to double
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call double @llvm.fmuladd.f64(double %13, double %15, double %17)
%19 = fptrunc double %18 to float
store float %19, float* %3
br label %35
20: ; preds = %0
%21 = load i32, i32* %2
%22 = icmp sgt i32 %21, 30
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load i32, i32* %2
%25 = sub nsw i32 %24, 30
%26 = sitofp i32 %25 to double
%27 = fmul double %26, 3.000000e-01
%28 = load float, float* %1
%29 = fpext float %28 to double
%30 = load float, float* %3
%31 = fpext float %30 to double
%32 = call double @llvm.fmuladd.f64(double %27, double %29, double %31)
%33 = fptrunc double %32 to float
store float %33, float* %3
br label %34
34: ; preds = %23, %20
br label %35
35: ; preds = %34, %9
%36 = load float, float* %1
%37 = load float, float* %3
%38 = fadd float %36, %37
store float %38, float* %4
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%40 = load float, float* %1
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %41)
%43 = load float, float* %3
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, 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 ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %47)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"Informe a quantidade de pecas montadas no mes: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [16 x i8] c"\09Minimo:\09R$%.2f\00"
@.str.4 = [18 x i8] c"\09Comissao:\09R$%.2f\00"
@.str.5 = [15 x i8] c"\09Bruto:\09R$%.2f\00"
@str = [9 x i8] c"Salario:\00"
define void @ex6() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 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), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 35
br i1 %6, label %7, label %13
7: ; preds = %0
%8 = add nsw i32 %5, -30
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 5.000000e-01
%11 = call double @llvm.fmuladd.f64(double %10, double 7.300000e+02, double 0.000000e+00)
%12 = fptrunc double %11 to float
br label %21
13: ; preds = %0
%14 = icmp sgt i32 %5, 30
br i1 %14, label %15, label %21
15: ; preds = %13
%16 = add nsw i32 %5, -30
%17 = sitofp i32 %16 to double
%18 = fmul double %17, 3.000000e-01
%19 = call double @llvm.fmuladd.f64(double %18, double 7.300000e+02, double 0.000000e+00)
%20 = fptrunc double %19 to float
br label %21
21: ; preds = %13, %15, %7
%22 = phi float [ %12, %7 ], [ %20, %15 ], [ 0.000000e+00, %13 ]
%23 = fadd float %22, 7.300000e+02
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double 7.300000e+02)
%26 = fpext float %22 to double
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %26)
%28 = fpext float %23 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %28)
ret void
}