#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *);
int log(double);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  FILE *file = fopen("dataset.txt\0", "r");
  if (file != NULL) {
    int base, exponent, max_line, line = 1;
    double result, max = 0;
    while (fscanf(file, "%d, %d", &base, &exponent) != EOF) {
      result = exponent * log((double)base);
      if (result > max) {
        max = result;
        max_line = line;
      }
      line++;
    }
    fclose(file);
    printf("The biggest value is at line %d\n\n", max_line);
  } else {
    printf("The file couldn't be found.\n\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1226 <main+0xd6>
movl   $0x1,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe74(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1050 <fscanf@plt>
mov    0x2e39(%rip),%rcx
cmp    (%rcx),%rax
je     1207 <main+0xb7>
mov    -0x18(%rbp),%eax
mov    %eax,-0x34(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
call   1060 <log@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    11f9 <main+0xa9>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1190 <main+0x40>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x1c(%rbp),%esi
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1234 <main+0xe4>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe8b(%rip),%rdi
lea    0xe91(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     123c <main+0xdc>
mov    %rax,%rbx
lea    0xe7b(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rax,%rdi
call   1060 <fscanf@plt>
mov    0x2e3b(%rip),%r15
cmp    (%r15),%rax
je     1222 <main+0xc2>
mov    $0x1,%r13d
xorps  %xmm0,%xmm0
lea    0x8(%rsp),%r12
movsd  %xmm0,0x10(%rsp)
mov    0x8(%rsp),%r14d
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
call   1070 <log@plt>
imul   %r14d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd %xmm1,%xmm0
cmova  %r13d,%ebp
maxsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0x1,%r13d
mov    %rbx,%rdi
lea    0xe05(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %r12,%rcx
call   1060 <fscanf@plt>
movsd  0x10(%rsp),%xmm0
cmp    (%r15),%rax
jne    11c0 <main+0x60>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xde5(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1248 <main+0xe8>
lea    0xdf5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"dataset.txt\00\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%d, %d\00"
@EOF = global i64 0
@.str.3 = [34 x i8] c"The biggest value is at line %d\0A\0A\00"
@.str.4 = [30 x i8] c"The file couldn't be found.\0A\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 double
%8 = alloca double
store i32 0, i32* %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 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
%10 = load i32*, i32** %2
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %39
12: ; preds = %0
store i32 1, i32* %6
store double 0.000000e+00, double* %8
br label %13
13: ; preds = %31, %12
%14 = load i32*, i32** %2
%15 = call i64 @fscanf(i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4)
%16 = load i64, i64* @EOF
%17 = icmp ne i64 %15, %16
br i1 %17, label %18, label %34
18: ; preds = %13
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to double
%22 = call i32 @log(double %21)
%23 = mul nsw i32 %19, %22
%24 = sitofp i32 %23 to double
store double %24, double* %7
%25 = load double, double* %7
%26 = load double, double* %8
%27 = fcmp ogt double %25, %26
br i1 %27, label %28, label %31
28: ; preds = %18
%29 = load double, double* %7
store double %29, double* %8
%30 = load i32, i32* %6
store i32 %30, i32* %5
br label %31
31: ; preds = %28, %18
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %13
34: ; preds = %13
%35 = load i32*, i32** %2
%36 = call i32 @fclose(i32* %35)
%37 = load i32, i32* %5
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %37)
br label %41
39: ; preds = %0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %41
41: ; preds = %39, %34
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"dataset.txt\00\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%d, %d\00"
@EOF = global i64 0
@.str.3 = [34 x i8] c"The biggest value is at line %d\0A\0A\00"
@str = [29 x i8] c"The file couldn't be found.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %32, label %5
5: ; preds = %0
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = call i64 @fscanf(i32* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%9 = load i64, i64* @EOF
%10 = icmp eq i64 %8, %9
br i1 %10, label %28, label %11
11: ; preds = %5, %11
%12 = phi double [ %23, %11 ], [ 0.000000e+00, %5 ]
%13 = phi i32 [ %22, %11 ], [ undef, %5 ]
%14 = phi i32 [ %24, %11 ], [ 1, %5 ]
%15 = load i32, i32* %2
%16 = load i32, i32* %1
%17 = sitofp i32 %16 to double
%18 = call i32 @log(double %17)
%19 = mul nsw i32 %18, %15
%20 = sitofp i32 %19 to double
%21 = fcmp olt double %12, %20
%22 = select i1 %21, i32 %14, i32 %13
%23 = select i1 %21, double %20, double %12
%24 = add nuw nsw i32 %14, 1
%25 = call i64 @fscanf(i32* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%26 = load i64, i64* @EOF
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %11
28: ; preds = %11, %5
%29 = phi i32 [ undef, %5 ], [ %22, %11 ]
%30 = call i32 @fclose(i32* %3)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %29)
br label %34
32: ; preds = %0
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %34
34: ; preds = %32, %28
ret i32 0
}