#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*/ fprintf(int /*<<< orphan*/ *, char *, char *, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ make_calculations(char **, int *, int, int /*<<< orphan*/ *);
int main() {
  FILE *fin = fopen("gift1.in", "r");
  FILE *fout = fopen("gift1.out", "w");
  int np;
  fscanf(fin, "%d", &np);
  char names[np][15];
  int moneys[np];
  for (int i = 0; i < np; i++) {
    moneys[i] = 0;
  }
  for (int i = 0; i < np; i++) {
    fscanf(fin, "%s", names[i]);
  }
  for (int i = 0; i < np; i++) {
    make_calculations(names, moneys, np, fin);
  }
  for (int i = 0; i < np; i++) {
    fprintf(fout, "%s %d\n", names[i], moneys[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe9e(%rip),%rdi
lea    0xea1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
xor    %eax,%eax
lea    -0x1c(%rbp),%rdx
call   1040 <fscanf@plt>
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    (%rax,%rax,4),%rcx
lea    0xf(%rcx,%rcx,2),%rdx
movabs $0x1ffffffff0,%rcx
and    %rcx,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1214 <main+0xd4>
mov    -0x50(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11eb <main+0xab>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1256 <main+0x116>
mov    -0x58(%rbp),%rdx
mov    -0x10(%rbp),%rdi
movslq -0x40(%rbp),%rax
imul   $0xf,%rax,%rax
add    %rax,%rdx
lea    0xdd9(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    121b <main+0xdb>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    128b <main+0x14b>
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rcx
call   1030 <make_calculations@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    125d <main+0x11d>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12d6 <main+0x196>
mov    -0x50(%rbp),%rax
mov    -0x58(%rbp),%rdx
mov    -0x18(%rbp),%rdi
movslq -0x48(%rbp),%rcx
imul   $0xf,%rcx,%rcx
add    %rcx,%rdx
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xd5a(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1292 <main+0x152>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe98(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
lea    0xe8d(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xe83(%rip),%rsi
lea    -0x2c(%rbp),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <fscanf@plt>
mov    %rsp,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
lea    (%rax,%rax,4),%rax
lea    (%rax,%rax,2),%rax
add    $0xf,%rax
movabs $0x1ffffffff0,%rcx
and    %rax,%rcx
mov    %rsp,%r14
sub    %rcx,%r14
mov    %r14,%rsp
mov    -0x2c(%rbp),%edx
mov    %rsp,%rdi
lea    0xf(,%rdx,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdi
mov    %rdi,%rsp
test   %edx,%edx
jle    1295 <main+0x145>
mov    %rbx,-0x38(%rbp)
shl    $0x2,%rdx
mov    %rdi,%r13
xor    %esi,%esi
call   1040 <memset@plt>
mov    %r14,%rbx
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
lea    0xe00(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <fscanf@plt>
add    $0x1,%r12
movslq -0x2c(%rbp),%rdx
add    $0xf,%rbx
cmp    %rdx,%r12
jl     1210 <main+0xc0>
test   %edx,%edx
mov    -0x38(%rbp),%r12
jle    1295 <main+0x145>
xor    %ebx,%ebx
nop
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r15,%rcx
call   1030 <make_calculations@plt>
add    $0x1,%ebx
mov    -0x2c(%rbp),%edx
cmp    %edx,%ebx
jl     1240 <main+0xf0>
mov    %r13,%rcx
test   %edx,%edx
jle    1295 <main+0x145>
xor    %ebx,%ebx
lea    0xdb5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%rcx,%rbx,4),%ecx
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1060 <fprintf@plt>
mov    %r13,%rcx
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0xf,%r14
cmp    %rax,%rbx
jl     1270 <main+0x120>
mov    -0x40(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"gift1.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"gift1.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [7 x i8] c"%s %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %2
%13 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %13, i32** %3
%14 = load i32*, i32** %2
%15 = call i32 (i32*, i8*, ...) @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%16 = load i32, i32* %4
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %5
%19 = alloca [15 x i8], i64 %17
store i64 %17, i64* %6
%20 = load i32, i32* %4
%21 = zext i32 %20 to i64
%22 = alloca i32, i64 %21
store i64 %21, i64* %7
store i32 0, i32* %8
br label %23
23: ; preds = %31, %0
%24 = load i32, i32* %8
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %34
27: ; preds = %23
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %22, i64 %29
store i32 0, i32* %30
br label %31
31: ; preds = %27
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %23
34: ; preds = %23
store i32 0, i32* %9
br label %35
35: ; preds = %46, %34
%36 = load i32, i32* %9
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %49
39: ; preds = %35
%40 = load i32*, i32** %2
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [15 x i8], [15 x i8]* %19, i64 %42
%44 = getelementptr inbounds [15 x i8], [15 x i8]* %43, i64 0, i64 0
%45 = call i32 (i32*, i8*, ...) @fscanf(i32* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %44)
br label %46
46: ; preds = %39
%47 = load i32, i32* %9
%48 = add nsw i32 %47, 1
store i32 %48, i32* %9
br label %35
49: ; preds = %35
store i32 0, i32* %10
br label %50
50: ; preds = %59, %49
%51 = load i32, i32* %10
%52 = load i32, i32* %4
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %62
54: ; preds = %50
%55 = bitcast [15 x i8]* %19 to i8**
%56 = load i32, i32* %4
%57 = load i32*, i32** %2
%58 = call i32 @make_calculations(i8** %55, i32* %22, i32 %56, i32* %57)
br label %59
59: ; preds = %54
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %50
62: ; preds = %50
store i32 0, i32* %11
br label %63
63: ; preds = %78, %62
%64 = load i32, i32* %11
%65 = load i32, i32* %4
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %81
67: ; preds = %63
%68 = load i32*, i32** %3
%69 = load i32, i32* %11
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [15 x i8], [15 x i8]* %19, i64 %70
%72 = getelementptr inbounds [15 x i8], [15 x i8]* %71, i64 0, i64 0
%73 = load i32, i32* %11
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %22, i64 %74
%76 = load i32, i32* %75
%77 = call i32 @fprintf(i32* %68, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %72, i32 %76)
br label %78
78: ; preds = %67
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 1
store i32 %80, i32* %11
br label %63
81: ; preds = %63
store i32 0, i32* %1
%82 = load i8*, i8** %5
%83 = load i32, i32* %1
ret i32 %83
}

LLVM IR (-O2):
@.str = [9 x i8] c"gift1.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"gift1.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [7 x i8] c"%s %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = call i32 (i32*, i8*, ...) @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca [15 x i8], i64 %7
%10 = load i32, i32* %1
%11 = zext i32 %10 to i64
%12 = alloca i32, i64 %11
%13 = icmp sgt i32 %10, 0
br i1 %13, label %14, label %38
14: ; preds = %0
%15 = bitcast i32* %12 to i8*
%16 = shl nuw nsw i64 %11, 2
br label %21
17: ; preds = %21
%18 = icmp sgt i32 %26, 0
br i1 %18, label %19, label %38
19: ; preds = %17
%20 = bitcast [15 x i8]* %9 to i8**
br label %31
21: ; preds = %14, %21
%22 = phi i64 [ 0, %14 ], [ %25, %21 ]
%23 = getelementptr inbounds [15 x i8], [15 x i8]* %9, i64 %22, i64 0
%24 = call i32 (i32*, i8*, ...) @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %23)
%25 = add nuw nsw i64 %22, 1
%26 = load i32, i32* %1
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %21, label %17
29: ; preds = %31
%30 = icmp sgt i32 %36, 0
br i1 %30, label %39, label %38
31: ; preds = %19, %31
%32 = phi i32 [ %26, %19 ], [ %36, %31 ]
%33 = phi i32 [ 0, %19 ], [ %35, %31 ]
%34 = call i32 @make_calculations(i8** %20, i32* %12, i32 %32, i32* %2)
%35 = add nuw nsw i32 %33, 1
%36 = load i32, i32* %1
%37 = icmp slt i32 %35, %36
br i1 %37, label %31, label %29
38: ; preds = %39, %0, %17, %29
ret i32 0
39: ; preds = %29, %39
%40 = phi i64 [ %45, %39 ], [ 0, %29 ]
%41 = getelementptr inbounds [15 x i8], [15 x i8]* %9, i64 %40, i64 0
%42 = getelementptr inbounds i32, i32* %12, i64 %40
%43 = load i32, i32* %42
%44 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %41, i32 %43)
%45 = add nuw nsw i64 %40, 1
%46 = load i32, i32* %1
%47 = sext i32 %46 to i64
%48 = icmp slt i64 %45, %47
br i1 %48, label %39, label %38
}