#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, int *);
int /*<<< orphan*/ printf(char *, long long);
int main() {
  FILE *f1;
  f1 = fopen("8.out", "r");
  long long int ans = 0;
  int i, a, b;
  for (i = 0; i < 5; i++) {
    fscanf(f1, "%*d %d %d", &a, &b);
    ans = ans + (long long int)a * (long long int)b;
  }
  printf("Total: %lld \n", ans);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11ac <main+0x7c>
mov    -0x10(%rbp),%rdi
lea    0xe8e(%rip),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1040 <fscanf@plt>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movslq -0x24(%rbp),%rdx
imul   %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1165 <main+0x35>
mov    -0x18(%rbp),%rsi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r13
lea    0xeb0(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%r12
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <fscanf@plt>
movslq 0x4(%rsp),%rax
movslq (%rsp),%rbx
imul   %rax,%rbx
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <fscanf@plt>
movslq 0x4(%rsp),%rax
movslq (%rsp),%rbp
imul   %rax,%rbp
add    %rbx,%rbp
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <fscanf@plt>
movslq 0x4(%rsp),%rax
movslq (%rsp),%rbx
imul   %rax,%rbx
add    %rbp,%rbx
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <fscanf@plt>
movslq 0x4(%rsp),%rax
movslq (%rsp),%rbp
imul   %rax,%rbp
add    %rbx,%rbp
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <fscanf@plt>
movslq 0x4(%rsp),%rax
movslq (%rsp),%rsi
imul   %rax,%rsi
add    %rbp,%rsi
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"8.out\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"%*d %d %d\00"
@.str.3 = [14 x i8] c"Total: %lld \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
store i64 0, i64* %3
store i32 0, i32* %4
br label %8
8: ; preds = %21, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load i32*, i32** %2
%13 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6)
%14 = load i64, i64* %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = mul nsw i64 %16, %18
%20 = add nsw i64 %14, %19
store i64 %20, i64* %3
br label %21
21: ; preds = %11
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %8
24: ; preds = %8
%25 = load i64, i64* %3
%26 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"8.out\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"%*d %d %d\00"
@.str.3 = [14 x i8] c"Total: %lld \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = sext i32 %7 to i64
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = mul nsw i64 %10, %8
%12 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = mul nsw i64 %16, %14
%18 = add nsw i64 %17, %11
%19 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%20 = load i32, i32* %1
%21 = sext i32 %20 to i64
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = mul nsw i64 %23, %21
%25 = add nsw i64 %24, %18
%26 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%27 = load i32, i32* %1
%28 = sext i32 %27 to i64
%29 = load i32, i32* %2
%30 = sext i32 %29 to i64
%31 = mul nsw i64 %30, %28
%32 = add nsw i64 %31, %25
%33 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%34 = load i32, i32* %1
%35 = sext i32 %34 to i64
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = mul nsw i64 %37, %35
%39 = add nsw i64 %38, %32
%40 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %39)
ret i32 0
}