#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 codigo[2];
  int qtd[2];
  double valores[2];
  double valor = 0;
  int i;
  for (i = 0; i < 2; i++) {
    scanf("%d %d %lf", &codigo[i], &qtd[i], &valores[i]);
    valor += valores[i] * qtd[i];
  }
  printf("VALOR A PAGAR: R$ %.2f\n", valor);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x2,-0x3c(%rbp)
jge    11b5 <main+0x95>
movslq -0x3c(%rbp),%rax
lea    -0xc(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
movslq -0x3c(%rbp),%rax
lea    -0x14(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
movslq -0x3c(%rbp),%rax
lea    -0x30(%rbp),%rcx
shl    $0x3,%rax
add    %rax,%rcx
lea    0xe84(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x3c(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
movslq -0x3c(%rbp),%rax
cvtsi2sdl -0x14(%rbp,%rax,4),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    113e <main+0x1e>
movsd  -0x38(%rbp),%xmm0
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

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

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

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