#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*/ fscanf(int /*<<< orphan*/ *, char *, double *);
void readMatrix(double matrix[][126], FILE *fPtr) {
  int i, j;
  for (i = 0; i < 126; i++) {
    for (j = 0; j < 7; j++) {
      fscanf(fPtr, "%lg", &matrix[j][i]);
    }
  }
}


x86 assembly (clang, -O0):
<readMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x7e,-0x14(%rbp)
jge    1190 <readMatrix+0x80>
movl   $0x0,-0x18(%rbp)
cmpl   $0x7,-0x18(%rbp)
jge    117d <readMatrix+0x6d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
movslq -0x18(%rbp),%rax
imul   $0x3f0,%rax,%rax
add    %rax,%rdx
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xe96(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1138 <readMatrix+0x28>
jmp    1182 <readMatrix+0x72>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <readMatrix+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readMatrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
xor    %ebx,%ebx
lea    0xed9(%rip),%r15
nopw   0x0(%rax,%rax,1)
lea    (%r12,%rbx,1),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <fscanf@plt>
lea    (%r12,%rbx,1),%rdx
add    $0x3f0,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <fscanf@plt>
lea    (%r12,%rbx,1),%rdx
add    $0x7e0,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <fscanf@plt>
lea    (%r12,%rbx,1),%rdx
add    $0xbd0,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <fscanf@plt>
lea    (%r12,%rbx,1),%rdx
add    $0xfc0,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <fscanf@plt>
lea    (%r12,%rbx,1),%rdx
add    $0x13b0,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <fscanf@plt>
lea    (%r12,%rbx,1),%rdx
add    $0x17a0,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <fscanf@plt>
add    $0x8,%rbx
cmp    $0x3f0,%rbx
jne    1130 <readMatrix+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lg\00"
define void @readMatrix([126 x double]* %0, i32* %1) {
%3 = alloca [126 x double]*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store [126 x double]* %0, [126 x double]** %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %7
7: ; preds = %28, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 126
br i1 %9, label %10, label %31
10: ; preds = %7
store i32 0, i32* %6
br label %11
11: ; preds = %24, %10
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 7
br i1 %13, label %14, label %27
14: ; preds = %11
%15 = load i32*, i32** %4
%16 = load [126 x double]*, [126 x double]** %3
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [126 x double], [126 x double]* %16, i64 %18
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [126 x double], [126 x double]* %19, i64 0, i64 %21
%23 = call i32 @fscanf(i32* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %22)
br label %24
24: ; preds = %14
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %11
27: ; preds = %11
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %7
31: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lg\00"
define void @readMatrix([126 x double]* %0, i32* nocapture %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i64 [ 0, %2 ], [ %19, %3 ]
%5 = getelementptr inbounds [126 x double], [126 x double]* %0, i64 0, i64 %4
%6 = tail call i32 @fscanf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %5)
%7 = getelementptr inbounds [126 x double], [126 x double]* %0, i64 1, i64 %4
%8 = tail call i32 @fscanf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %7)
%9 = getelementptr inbounds [126 x double], [126 x double]* %0, i64 2, i64 %4
%10 = tail call i32 @fscanf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %9)
%11 = getelementptr inbounds [126 x double], [126 x double]* %0, i64 3, i64 %4
%12 = tail call i32 @fscanf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %11)
%13 = getelementptr inbounds [126 x double], [126 x double]* %0, i64 4, i64 %4
%14 = tail call i32 @fscanf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %13)
%15 = getelementptr inbounds [126 x double], [126 x double]* %0, i64 5, i64 %4
%16 = tail call i32 @fscanf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %15)
%17 = getelementptr inbounds [126 x double], [126 x double]* %0, i64 6, i64 %4
%18 = tail call i32 @fscanf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %17)
%19 = add nuw nsw i64 %4, 1
%20 = icmp eq i64 %19, 126
br i1 %20, label %21, label %3
21: ; preds = %3
ret void
}