#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() {
  float valorT, valorF;
  int op;
  printf("Digite o valor total da sua compra: ");
  scanf("%f", &valorT);
  printf("Digite o numero da opcao de pagamento, estao listadas abaixo: \n");
  printf("1-Dinheiro\n2-Cartao debito\n3-Cartao credito 2x\n4-Cartao credito "
         "3x\n");
  scanf("%d", &op);
  switch (op) {
  case 1:
    printf("O valor total da sua conta ficou: %0.2f", valorT * 0.9);
    break;
  case 2:
    printf("O valor total da sua conta ficou: %0.2f", valorT * 0.8);
    break;
  case 3:
    valorF = valorT * 1.1;
    printf(
        "O valor total da sua conta ficou: %0.2f,\ne das 3 parcelas: %0.2f\n",
        valorF, valorF / 2);
    break;
  case 4:
    valorF = valorT * 1.15;
    printf(
        "O valor total da sua conta ficou: %0.2f,\ne das 3 parcelas: %0.2f\n",
        valorF, valorF / 3);
    break;
  default:
    printf("Opcao invalida!\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf02(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xf13(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x19(%rbp),%al
lea    0xf03(%rip),%rdi
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xf34(%rip),%rdi
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xf69(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     129b <main+0x17b>
mov    -0x18(%rbp),%rax
lea    0xe84(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe62(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xf1e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12a9 <main+0x189>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe32(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xef6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12a9 <main+0x189>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe02(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xdd3(%rip),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xecf(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    12a9 <main+0x189>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdab(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xd80(%rip),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe80(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    12a9 <main+0x189>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf00(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf17(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf76(%rip),%rdi
call   1030 <puts@plt>
lea    0xfa9(%rip),%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11aa <main+0x7a>
lea    0xe9a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe70(%rip),%xmm0
jmp    11c9 <main+0x99>
lea    0xf9e(%rip),%rdi
call   1030 <puts@plt>
jmp    1235 <main+0x105>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe47(%rip),%xmm0
lea    0xe93(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1235 <main+0x105>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe1e(%rip),%xmm0
cvtsd2ss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mulss  0xe27(%rip),%xmm1
jmp    1223 <main+0xf3>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xdf0(%rip),%xmm0
cvtsd2ss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
divss  0xdfd(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe5d(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Digite o valor total da sua compra: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [64 x i8] c"Digite o numero da opcao de pagamento, estao listadas abaixo: \0A\00"
@.str.3 = [68 x i8] c"1-Dinheiro\0A2-Cartao debito\0A3-Cartao credito 2x\0A4-Cartao credito 3x\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [40 x i8] c"O valor total da sua conta ficou: %0.2f\00"
@.str.6 = [66 x i8] c"O valor total da sua conta ficou: %0.2f,\0Ae das 3 parcelas: %0.2f\0A\00"
@.str.7 = [17 x i8] c"Opcao invalida!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 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), float* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
switch i32 %10, label %43 [
i32 1, label %11
i32 2, label %16
i32 3, label %21
i32 4, label %32
]
11: ; preds = %0
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = fmul double %13, 9.000000e-01
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %14)
br label %45
16: ; preds = %0
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = fmul double %18, 8.000000e-01
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %19)
br label %45
21: ; preds = %0
%22 = load float, float* %2
%23 = fpext float %22 to double
%24 = fmul double %23, 1.100000e+00
%25 = fptrunc double %24 to float
store float %25, float* %3
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = load float, float* %3
%29 = fdiv float %28, 2.000000e+00
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0), double %27, double %30)
br label %45
32: ; preds = %0
%33 = load float, float* %2
%34 = fpext float %33 to double
%35 = fmul double %34, 1.150000e+00
%36 = fptrunc double %35 to float
store float %36, float* %3
%37 = load float, float* %3
%38 = fpext float %37 to double
%39 = load float, float* %3
%40 = fdiv float %39, 3.000000e+00
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0), double %38, double %41)
br label %45
43: ; preds = %0
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
br label %45
45: ; preds = %43, %32, %21, %16, %11
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str = [37 x i8] c"Digite o valor total da sua compra: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [40 x i8] c"O valor total da sua conta ficou: %0.2f\00"
@.str.6 = [66 x i8] c"O valor total da sua conta ficou: %0.2f,\0Ae das 3 parcelas: %0.2f\0A\00"
@str = [63 x i8] c"Digite o numero da opcao de pagamento, estao listadas abaixo: \00"
@str.8 = [67 x i8] c"1-Dinheiro\0A2-Cartao debito\0A3-Cartao credito 2x\0A4-Cartao credito 3x\00"
@str.9 = [16 x i8] c"Opcao invalida!\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = bitcast float* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 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), float* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.8, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
switch i32 %10, label %39 [
i32 1, label %11
i32 2, label %16
i32 3, label %21
i32 4, label %30
]
11: ; preds = %0
%12 = load float, float* %1
%13 = fpext float %12 to double
%14 = fmul double %13, 9.000000e-01
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %14)
br label %41
16: ; preds = %0
%17 = load float, float* %1
%18 = fpext float %17 to double
%19 = fmul double %18, 8.000000e-01
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %19)
br label %41
21: ; preds = %0
%22 = load float, float* %1
%23 = fpext float %22 to double
%24 = fmul double %23, 1.100000e+00
%25 = fptrunc double %24 to float
%26 = fpext float %25 to double
%27 = fmul float %25, 5.000000e-01
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0), double %26, double %28)
br label %41
30: ; preds = %0
%31 = load float, float* %1
%32 = fpext float %31 to double
%33 = fmul double %32, 1.150000e+00
%34 = fptrunc double %33 to float
%35 = fpext float %34 to double
%36 = fdiv float %34, 3.000000e+00
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0), double %35, double %37)
br label %41
39: ; preds = %0
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.9, i64 0, i64 0))
br label %41
41: ; preds = %39, %30, %21, %16, %11
ret i32 0
}