#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 i, code, units = 1;
  double price = 0.0, total = 0.0;
  for (i = 0; i < 2; i++, total += price * units)
    scanf("%d %d %lf", &code, &units, &price);
  printf("VALOR A PAGAR: R$ %.2lf\n", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1199 <main+0x79>
lea    0xea2(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    114d <main+0x2d>
movsd  -0x20(%rbp),%xmm0
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x1,0xc(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xebd(%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    0xe60(%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 i32
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store i32 1, i32* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
store i32 0, i32* %2
br label %7
7: ; preds = %12, %0
%8 = load i32, i32* %2
%9 = icmp slt 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* %3, i32* %4, double* %5)
br label %12
12: ; preds = %10
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
%15 = load double, double* %5
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to double
%18 = load double, double* %6
%19 = call double @llvm.fmuladd.f64(double %15, double %17, double %18)
store double %19, double* %6
br label %7
20: ; preds = %7
%21 = load double, double* %6
%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*
store i32 1, i32* %2
%6 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%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 double, double* %3
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = call double @llvm.fmuladd.f64(double %8, 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 double, double* %3
%14 = load i32, i32* %2
%15 = sitofp i32 %14 to double
%16 = call double @llvm.fmuladd.f64(double %13, 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
}