#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 valor, valor1, valor2;
  int tipo_pag;
  printf("Qual o valor de sua compra?\n");
  scanf("%f", &valor);
  printf("\nSelecione o tipo de pagamento:\n 1 - A Vista \n 2 - A Prazo\n");
  scanf("%d", &tipo_pag);
  if (tipo_pag == 1) {
    valor1 = valor * 10 / 100;
    valor2 = valor - valor1;
    printf("\nO valor da sua compra e %.2f com o desconto de %f\n", valor2,
           valor1);
  } else {
    valor1 = valor / 3;
    printf("\nO valor das parcelas sera %.2f\n", valor1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11cb <main+0xab>
movss  0xe87(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  0xe76(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeac(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    11f8 <main+0xd8>
movss  -0x8(%rbp),%xmm0
movss  0xe28(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeae(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf2c(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x1,(%rsp)
movss  0x4(%rsp),%xmm0
jne    11a9 <main+0x79>
movss  0xe83(%rip),%xmm1
mulss  %xmm0,%xmm1
divss  0xe7b(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe72(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    11c3 <main+0x93>
divss  0xe4f(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Qual o valor de sua compra?\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [60 x i8] c"\0ASelecione o tipo de pagamento:\0A 1 - A Vista \0A 2 - A Prazo\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [52 x i8] c"\0AO valor da sua compra e %.2f com o desconto de %f\0A\00"
@.str.5 = [33 x i8] c"\0AO valor das parcelas sera %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %24
12: ; preds = %0
%13 = load float, float* %2
%14 = fmul float %13, 1.000000e+01
%15 = fdiv float %14, 1.000000e+02
store float %15, float* %3
%16 = load float, float* %2
%17 = load float, float* %3
%18 = fsub float %16, %17
store float %18, float* %4
%19 = load float, float* %4
%20 = fpext float %19 to double
%21 = load float, float* %3
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), double %20, double %22)
br label %30
24: ; preds = %0
%25 = load float, float* %2
%26 = fdiv float %25, 3.000000e+00
store float %26, float* %3
%27 = load float, float* %3
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), double %28)
br label %30
30: ; preds = %24, %12
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [52 x i8] c"\0AO valor da sua compra e %.2f com o desconto de %f\0A\00"
@.str.5 = [33 x i8] c"\0AO valor das parcelas sera %.2f\0A\00"
@str = [28 x i8] c"Qual o valor de sua compra?\00"
@str.6 = [59 x i8] c"\0ASelecione o tipo de pagamento:\0A 1 - A Vista \0A 2 - A Prazo\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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 ([59 x i8], [59 x i8]* @str.6, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
%11 = load float, float* %1
br i1 %10, label %12, label %19
12: ; preds = %0
%13 = fmul float %11, 1.000000e+01
%14 = fdiv float %13, 1.000000e+02
%15 = fsub float %11, %14
%16 = fpext float %15 to double
%17 = fpext float %14 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), double %16, double %17)
br label %23
19: ; preds = %0
%20 = fdiv float %11, 3.000000e+00
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), double %21)
br label %23
23: ; preds = %19, %12
ret i32 0
}