#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 *, double);
int /*<<< orphan*/ scanf(char *, int *, int *, double *);
int main() {
  int codeOfProduct, unitOfProduct;
  double amountOfPerProduct, totalAmountOfProduct = 0;
  for (int i = 1; i <= 2; i++) {
    scanf("%d %d %lf", &codeOfProduct, &unitOfProduct, &amountOfPerProduct);
    totalAmountOfProduct += unitOfProduct * amountOfPerProduct;
  }
  printf("VALOR A PAGAR: R$ %.2lf\n", totalAmountOfProduct);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jg     118a <main+0x6a>
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <scanf@plt>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113e <main+0x1e>
movsd  -0x20(%rbp),%xmm0
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xece(%rip),%rbx
lea    0x24(%rsp),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <scanf@plt>
cvtsi2sdl 0xc(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
xorpd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d %lf\00"
@.str.1 = [25 x i8] c"VALOR A PAGAR: R$ %.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %5
store i32 1, i32* %6
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %6
%9 = icmp sle i32 %8, 2
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, double* %4)
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to double
%14 = load double, double* %4
%15 = load double, double* %5
%16 = call double @llvm.fmuladd.f64(double %13, double %14, double %15)
store double %16, double* %5
br label %17
17: ; preds = %10
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %7
20: ; preds = %7
%21 = load double, double* %5
%22 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %lf\00"
@.str.1 = [25 x i8] c"VALOR A PAGAR: R$ %.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, double* %3)
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to double
%10 = load double, double* %3
%11 = call double @llvm.fmuladd.f64(double %9, double %10, double 0.000000e+00)
%12 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, double* %3)
%13 = load i32, i32* %2
%14 = sitofp i32 %13 to double
%15 = load double, double* %3
%16 = call double @llvm.fmuladd.f64(double %14, double %15, double %11)
%17 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %16)
ret i32 0
}