#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 /*<<< orphan*/ free_matrix(double **, int /*<<< orphan*/, int, int, int);
double **matrix(int /*<<< orphan*/, int, int, int);
double mmax(double **, int, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ rand();
void main() {
  int imax = 2, jmax = 10;
  double **M;
  int i, j;
  M = matrix(0, imax, 5, jmax);
  for (i = 0; i < imax + 1; i++) {
    for (j = 5; j <= jmax; j++) {
      M[i][j] = (double)rand() / 1357.591 - 1000000;
    }
  }
  for (i = 0; i < imax + 1; i++) {
    for (j = 5; j <= jmax; j++) {
      printf("%f ", M[i][j]);
    }
    printf("\n");
  }
  double maxi = mmax(M, imax, jmax);
  printf("\n maximum is %f \n", maxi);
  free_matrix(M, 0, imax, 5, jmax);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x2,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%ecx
xor    %edi,%edi
mov    $0x5,%edx
call   1060 <matrix@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1201 <main+0xb1>
movl   $0x5,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ee <main+0x9e>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
movsd  0xe4d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe39(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119b <main+0x4b>
jmp    11f3 <main+0xa3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1183 <main+0x33>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1279 <main+0x129>
movl   $0x5,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     125d <main+0x10d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdc8(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1220 <main+0xd0>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1208 <main+0xb8>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1040 <mmax@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xd7b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%r8d
xor    %esi,%esi
mov    $0x5,%ecx
call   1030 <free_matrix@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x5,%edx
mov    $0xa,%ecx
call   1070 <matrix@plt>
mov    %rax,%r15
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xe69(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe65(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    (%r15,%rbx,8),%rax
movsd  %xmm0,0x28(%rax)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xe39(%rip),%xmm0
addsd  0xe39(%rip),%xmm0
mov    (%r15,%rbx,8),%rax
movsd  %xmm0,0x30(%rax)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xe11(%rip),%xmm0
addsd  0xe11(%rip),%xmm0
mov    (%r15,%rbx,8),%rax
movsd  %xmm0,0x38(%rax)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xde9(%rip),%xmm0
addsd  0xde9(%rip),%xmm0
mov    (%r15,%rbx,8),%rax
movsd  %xmm0,0x40(%rax)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xdc1(%rip),%xmm0
addsd  0xdc1(%rip),%xmm0
mov    (%r15,%rbx,8),%rax
movsd  %xmm0,0x48(%rax)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xd99(%rip),%xmm0
addsd  0xd99(%rip),%xmm0
mov    (%r15,%rbx,8),%rax
movsd  %xmm0,0x50(%rax)
add    $0x1,%rbx
cmp    $0x3,%rbx
jne    1180 <main+0x20>
mov    (%r15),%rax
movsd  0x28(%rax),%xmm0
lea    0xd7b(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r15),%rax
movsd  0x30(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r15),%rax
movsd  0x38(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r15),%rax
movsd  0x40(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r15),%rax
movsd  0x48(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r15),%rax
movsd  0x50(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%r15),%rax
movsd  0x28(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x8(%r15),%rax
movsd  0x30(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x8(%r15),%rax
movsd  0x38(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x8(%r15),%rax
movsd  0x40(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x8(%r15),%rax
movsd  0x48(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x8(%r15),%rax
movsd  0x50(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%r15),%rax
movsd  0x28(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x10(%r15),%rax
movsd  0x30(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x10(%r15),%rax
movsd  0x38(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x10(%r15),%rax
movsd  0x40(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x10(%r15),%rax
movsd  0x48(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x10(%r15),%rax
movsd  0x50(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    $0xa,%edx
call   1050 <mmax@plt>
lea    0xc00(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x5,%ecx
mov    $0xa,%r8d
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <free_matrix@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%f \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [18 x i8] c"\0A maximum is %f \0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double**
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store i32 2, i32* %1
store i32 10, i32* %2
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call double** @matrix(i32 0, i32 %7, i32 5, i32 %8)
store double** %9, double*** %3
store i32 0, i32* %4
br label %10
10: ; preds = %37, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %40
15: ; preds = %10
store i32 5, i32* %5
br label %16
16: ; preds = %33, %15
%17 = load i32, i32* %5
%18 = load i32, i32* %2
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %36
20: ; preds = %16
%21 = call i64 (...) @rand()
%22 = sitofp i64 %21 to double
%23 = fdiv double %22, 0x4095365D2F1A9FBE
%24 = fsub double %23, 1.000000e+06
%25 = load double**, double*** %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double*, double** %25, i64 %27
%29 = load double*, double** %28
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
store double %24, double* %32
br label %33
33: ; preds = %20
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %16
36: ; preds = %16
br label %37
37: ; preds = %36
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %10
40: ; preds = %10
store i32 0, i32* %4
br label %41
41: ; preds = %67, %40
%42 = load i32, i32* %4
%43 = load i32, i32* %1
%44 = add nsw i32 %43, 1
%45 = icmp slt i32 %42, %44
br i1 %45, label %46, label %70
46: ; preds = %41
store i32 5, i32* %5
br label %47
47: ; preds = %62, %46
%48 = load i32, i32* %5
%49 = load i32, i32* %2
%50 = icmp sle i32 %48, %49
br i1 %50, label %51, label %65
51: ; preds = %47
%52 = load double**, double*** %3
%53 = load i32, i32* %4
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double*, double** %52, i64 %54
%56 = load double*, double** %55
%57 = load i32, i32* %5
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %60)
br label %62
62: ; preds = %51
%63 = load i32, i32* %5
%64 = add nsw i32 %63, 1
store i32 %64, i32* %5
br label %47
65: ; preds = %47
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %67
67: ; preds = %65
%68 = load i32, i32* %4
%69 = add nsw i32 %68, 1
store i32 %69, i32* %4
br label %41
70: ; preds = %41
%71 = load double**, double*** %3
%72 = load i32, i32* %1
%73 = load i32, i32* %2
%74 = call double @mmax(double** %71, i32 %72, i32 %73)
store double %74, double* %6
%75 = load double, double* %6
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %75)
%77 = load double**, double*** %3
%78 = load i32, i32* %1
%79 = load i32, i32* %2
%80 = call i32 @free_matrix(double** %77, i32 0, i32 %78, i32 5, i32 %79)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f \00"
@.str.2 = [18 x i8] c"\0A maximum is %f \0A\00"
define void @main() {
%1 = tail call double** @matrix(i32 0, i32 2, i32 5, i32 10)
br label %2
2: ; preds = %0, %2
%3 = phi i64 [ 0, %0 ], [ %41, %2 ]
%4 = getelementptr inbounds double*, double** %1, i64 %3
%5 = tail call i64 (...) @rand()
%6 = sitofp i64 %5 to double
%7 = fdiv double %6, 0x4095365D2F1A9FBE
%8 = fadd double %7, -1.000000e+06
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 5
store double %8, double* %10
%11 = tail call i64 (...) @rand()
%12 = sitofp i64 %11 to double
%13 = fdiv double %12, 0x4095365D2F1A9FBE
%14 = fadd double %13, -1.000000e+06
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 6
store double %14, double* %16
%17 = tail call i64 (...) @rand()
%18 = sitofp i64 %17 to double
%19 = fdiv double %18, 0x4095365D2F1A9FBE
%20 = fadd double %19, -1.000000e+06
%21 = load double*, double** %4
%22 = getelementptr inbounds double, double* %21, i64 7
store double %20, double* %22
%23 = tail call i64 (...) @rand()
%24 = sitofp i64 %23 to double
%25 = fdiv double %24, 0x4095365D2F1A9FBE
%26 = fadd double %25, -1.000000e+06
%27 = load double*, double** %4
%28 = getelementptr inbounds double, double* %27, i64 8
store double %26, double* %28
%29 = tail call i64 (...) @rand()
%30 = sitofp i64 %29 to double
%31 = fdiv double %30, 0x4095365D2F1A9FBE
%32 = fadd double %31, -1.000000e+06
%33 = load double*, double** %4
%34 = getelementptr inbounds double, double* %33, i64 9
store double %32, double* %34
%35 = tail call i64 (...) @rand()
%36 = sitofp i64 %35 to double
%37 = fdiv double %36, 0x4095365D2F1A9FBE
%38 = fadd double %37, -1.000000e+06
%39 = load double*, double** %4
%40 = getelementptr inbounds double, double* %39, i64 10
store double %38, double* %40
%41 = add nuw nsw i64 %3, 1
%42 = icmp eq i64 %41, 3
br i1 %42, label %43, label %2
43: ; preds = %2
%44 = load double*, double** %1
%45 = getelementptr inbounds double, double* %44, i64 5
%46 = load double, double* %45
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %46)
%48 = load double*, double** %1
%49 = getelementptr inbounds double, double* %48, i64 6
%50 = load double, double* %49
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %50)
%52 = load double*, double** %1
%53 = getelementptr inbounds double, double* %52, i64 7
%54 = load double, double* %53
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %54)
%56 = load double*, double** %1
%57 = getelementptr inbounds double, double* %56, i64 8
%58 = load double, double* %57
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %58)
%60 = load double*, double** %1
%61 = getelementptr inbounds double, double* %60, i64 9
%62 = load double, double* %61
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %62)
%64 = load double*, double** %1
%65 = getelementptr inbounds double, double* %64, i64 10
%66 = load double, double* %65
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %66)
%68 = tail call i32 @putchar(i32 10)
%69 = getelementptr inbounds double*, double** %1, i64 1
%70 = load double*, double** %69
%71 = getelementptr inbounds double, double* %70, i64 5
%72 = load double, double* %71
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %72)
%74 = load double*, double** %69
%75 = getelementptr inbounds double, double* %74, i64 6
%76 = load double, double* %75
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %76)
%78 = load double*, double** %69
%79 = getelementptr inbounds double, double* %78, i64 7
%80 = load double, double* %79
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %80)
%82 = load double*, double** %69
%83 = getelementptr inbounds double, double* %82, i64 8
%84 = load double, double* %83
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %84)
%86 = load double*, double** %69
%87 = getelementptr inbounds double, double* %86, i64 9
%88 = load double, double* %87
%89 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %88)
%90 = load double*, double** %69
%91 = getelementptr inbounds double, double* %90, i64 10
%92 = load double, double* %91
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %92)
%94 = tail call i32 @putchar(i32 10)
%95 = getelementptr inbounds double*, double** %1, i64 2
%96 = load double*, double** %95
%97 = getelementptr inbounds double, double* %96, i64 5
%98 = load double, double* %97
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %98)
%100 = load double*, double** %95
%101 = getelementptr inbounds double, double* %100, i64 6
%102 = load double, double* %101
%103 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %102)
%104 = load double*, double** %95
%105 = getelementptr inbounds double, double* %104, i64 7
%106 = load double, double* %105
%107 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %106)
%108 = load double*, double** %95
%109 = getelementptr inbounds double, double* %108, i64 8
%110 = load double, double* %109
%111 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %110)
%112 = load double*, double** %95
%113 = getelementptr inbounds double, double* %112, i64 9
%114 = load double, double* %113
%115 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %114)
%116 = load double*, double** %95
%117 = getelementptr inbounds double, double* %116, i64 10
%118 = load double, double* %117
%119 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %118)
%120 = tail call i32 @putchar(i32 10)
%121 = tail call double @mmax(double** %1, i32 2, i32 10)
%122 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %121)
%123 = tail call i32 @free_matrix(double** %1, i32 0, i32 2, i32 5, i32 10)
ret void
}