#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*/ AddLeaderboard(char *, int);
scalar_t__ EOF;
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, ...);
void ReadLeaderboard(FILE *src) {
  char name[200];
  int score;
  while (fscanf(src, "%s", name) != EOF) {
    fscanf(src, "%d", &score);
    AddLeaderboard(name, score);
  }
}


x86 assembly (clang, -O0):
<ReadLeaderboard>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xd0(%rbp),%rdx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <fscanf@plt>
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%rax
je     1188 <ReadLeaderboard+0x68>
mov    -0x8(%rbp),%rdi
lea    0xea0(%rip),%rsi
lea    -0xd4(%rbp),%rdx
mov    $0x0,%al
call   1030 <fscanf@plt>
lea    -0xd0(%rbp),%rdi
mov    -0xd4(%rbp),%esi
call   1040 <AddLeaderboard@plt>
jmp    112f <ReadLeaderboard+0xf>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadLeaderboard>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1030 <fscanf@plt>
mov    0x2e9a(%rip),%rbp
cmp    0x0(%rbp),%rax
je     11a2 <ReadLeaderboard+0x82>
lea    0xea8(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xe94(%rip),%r13
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <fscanf@plt>
mov    0xc(%rsp),%esi
mov    %r12,%rdi
call   1040 <AddLeaderboard@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <fscanf@plt>
cmp    0x0(%rbp),%rax
jne    1170 <ReadLeaderboard+0x50>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%d\00"
define void @ReadLeaderboard(i32* %0) {
%2 = alloca i32*
%3 = alloca [200 x i8]
%4 = alloca i32
store i32* %0, i32** %2
br label %5
5: ; preds = %11, %1
%6 = load i32*, i32** %2
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%8 = call i64 (i32*, i8*, ...) @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i64, i64* @EOF
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %17
11: ; preds = %5
%12 = load i32*, i32** %2
%13 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%15 = load i32, i32* %4
%16 = call i32 @AddLeaderboard(i8* %14, i32 %15)
br label %5
17: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%d\00"
define void @ReadLeaderboard(i32* nocapture %0) {
%2 = alloca [200 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%5 = bitcast i32* %3 to i8*
%6 = call i64 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %16, label %9
9: ; preds = %1, %9
%10 = call i64 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = call i32 @AddLeaderboard(i8* %4, i32 %11)
%13 = call i64 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %13, %14
br i1 %15, label %16, label %9
16: ; preds = %9, %1
ret void
}