#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 */
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *);
int log2(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  FILE *fd = fopen("../res/099.data", "r");
  int max = 0;
  int maxl = 0;
  int line = 1;
  int base, exp;
  while (fscanf(fd, "%d,%d", &base, &exp) != EOF) {
    int cand = exp * log2(base);
    if (cand > max) {
      max = cand;
      maxl = line;
    }
    ++line;
  }
  printf("%u\n", maxl);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8c(%rip),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1050 <fscanf@plt>
mov    0x2e4e(%rip),%rcx
cmp    (%rcx),%rax
je     11e2 <main+0xa2>
mov    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <log2@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11d4 <main+0x94>
mov    -0x28(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117b <main+0x3b>
mov    -0x18(%rbp),%esi
lea    0xe2c(%rip),%rdi
call   1040 <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    0xeae(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xeaa(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rax,%rdi
call   1050 <fscanf@plt>
mov    0x2e69(%rip),%r12
xor    %ebp,%ebp
cmp    (%r12),%rax
je     11dd <main+0x9d>
mov    $0x1,%r13d
xor    %r14d,%r14d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rsp),%r15d
mov    0x4(%rsp),%edi
call   1030 <log2@plt>
imul   %r15d,%eax
cmp    %r14d,%eax
cmovg  %r13d,%ebp
cmovg  %eax,%r14d
add    $0x1,%r13d
mov    %rbx,%rdi
lea    0xe48(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
call   1050 <fscanf@plt>
cmp    (%r12),%rax
jne    11a0 <main+0x60>
lea    0xe34(%rip),%rdi
mov    %ebp,%esi
call   1040 <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 = [16 x i8] c"../res/099.data\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%d,%d\00"
@EOF = global i64 0
@.str.3 = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 1, i32* %5
br label %10
10: ; preds = %26, %0
%11 = load i32*, i32** %2
%12 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %6, i32* %7)
%13 = load i64, i64* @EOF
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %29
15: ; preds = %10
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = call i32 @log2(i32 %17)
%19 = mul nsw i32 %16, %18
store i32 %19, i32* %8
%20 = load i32, i32* %8
%21 = load i32, i32* %3
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %15
%24 = load i32, i32* %8
store i32 %24, i32* %3
%25 = load i32, i32* %5
store i32 %25, i32* %4
br label %26
26: ; preds = %23, %15
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %10
29: ; preds = %10
%30 = load i32, i32* %4
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"../res/099.data\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%d,%d\00"
@EOF = global i64 0
@.str.3 = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 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 i64 @fscanf(i32* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %24, label %9
9: ; preds = %0, %9
%10 = phi i32 [ %19, %9 ], [ 0, %0 ]
%11 = phi i32 [ %20, %9 ], [ 1, %0 ]
%12 = phi i32 [ %18, %9 ], [ 0, %0 ]
%13 = load i32, i32* %2
%14 = load i32, i32* %1
%15 = call i32 @log2(i32 %14)
%16 = mul nsw i32 %15, %13
%17 = icmp sgt i32 %16, %10
%18 = select i1 %17, i32 %11, i32 %12
%19 = select i1 %17, i32 %16, i32 %10
%20 = add nuw nsw i32 %11, 1
%21 = call i64 @fscanf(i32* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%22 = load i64, i64* @EOF
%23 = icmp eq i64 %21, %22
br i1 %23, label %24, label %9
24: ; preds = %9, %0
%25 = phi i32 [ 0, %0 ], [ %18, %9 ]
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %25)
ret i32 0
}