#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 log(int);
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *, int *);
int main(void) {
  int base = 0;
  int exponent = 0;
  int lineno = 0;
  double max_log_value = 0.0;
  int max_lineno = 0;
  while (scanf("%d,%d\n", &base, &exponent) == 2) {
    lineno++;
    double log_value = exponent * log(base);
    if (log_value > max_log_value) {
      max_log_value = log_value;
      max_lineno = lineno;
    }
  }
  if (max_lineno > 0)
    printf("%d\n", max_lineno);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xe96(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    11cd <main+0x9d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <log@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11c8 <main+0x98>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1163 <main+0x33>
cmpl   $0x0,-0x1c(%rbp)
jle    11e6 <main+0xb6>
mov    -0x1c(%rbp),%esi
lea    0xe22(%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
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xeab(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    11f4 <main+0xc4>
xorps  %xmm0,%xmm0
xor    %ebx,%ebx
mov    $0x1,%ebp
lea    0xe82(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x10(%rsp)
mov    0x8(%rsp),%r13d
mov    0xc(%rsp),%edi
call   1050 <log@plt>
imul   %r13d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd %xmm1,%xmm0
maxsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
cmova  %ebp,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <scanf@plt>
add    $0x1,%ebp
movsd  0x10(%rsp),%xmm0
cmp    $0x2,%eax
je     1190 <main+0x60>
test   %ebx,%ebx
jle    11f4 <main+0xc4>
lea    0xe16(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d,%d\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca i32
%7 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store double 0.000000e+00, double* %5
store i32 0, i32* %6
br label %8
8: ; preds = %25, %0
%9 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = call i32 @log(i32 %15)
%17 = mul nsw i32 %14, %16
%18 = sitofp i32 %17 to double
store double %18, double* %7
%19 = load double, double* %7
%20 = load double, double* %5
%21 = fcmp ogt double %19, %20
br i1 %21, label %22, label %25
22: ; preds = %11
%23 = load double, double* %7
store double %23, double* %5
%24 = load i32, i32* %4
store i32 %24, i32* %6
br label %25
25: ; preds = %22, %11
br label %8
26: ; preds = %8
%27 = load i32, i32* %6
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %6
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %26
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d,%d\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %26
7: ; preds = %0, %7
%8 = phi i32 [ %11, %7 ], [ 0, %0 ]
%9 = phi i32 [ %19, %7 ], [ 0, %0 ]
%10 = phi double [ %18, %7 ], [ 0.000000e+00, %0 ]
%11 = add nuw nsw i32 %8, 1
%12 = load i32, i32* %2
%13 = load i32, i32* %1
%14 = call i32 @log(i32 %13)
%15 = mul nsw i32 %14, %12
%16 = sitofp i32 %15 to double
%17 = fcmp olt double %10, %16
%18 = select i1 %17, double %16, double %10
%19 = select i1 %17, i32 %11, i32 %9
%20 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%21 = icmp eq i32 %20, 2
br i1 %21, label %7, label %22
22: ; preds = %7
%23 = icmp sgt i32 %19, 0
br i1 %23, label %24, label %26
24: ; preds = %22
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %26
26: ; preds = %0, %24, %22
ret i32 0
}