#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 */
double abs(double);
int /*<<< orphan*/ printf(char *, char *, int, double);
void maxnormTriangle(double **data, int baseSize, char *name, int level) {
  int i, j;
  double max;
  for (i = 0; i < baseSize; i++) {
    for (j = 0; j < baseSize - i; j++) {
      if (max < abs(data[i][j]))
        max = abs(data[i][j]);
    }
  }
  printf("Max of %s(%d): %1.3e\n", name, level, max);
}


x86 assembly (clang, -O0):
<maxnormTriangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d9 <maxnormTriangle+0xb9>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    11c6 <maxnormTriangle+0xa6>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <abs@plt>
movsd  -0x38(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b3 <maxnormTriangle+0x93>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <abs@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    11b8 <maxnormTriangle+0x98>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1150 <maxnormTriangle+0x30>
jmp    11cb <maxnormTriangle+0xab>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113d <maxnormTriangle+0x1d>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
movsd  -0x30(%rbp),%xmm0
lea    0xe14(%rip),%rdi
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxnormTriangle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,0x10(%rsp)
mov    %rdx,0x18(%rsp)
mov    %esi,%r14d
mov    %rdi,%rbx
mov    %esi,%eax
mov    %rax,0x20(%rsp)
xor    %ebp,%ebp
mov    %esi,%r13d
mov    %esi,0x14(%rsp)
jmp    1163 <maxnormTriangle+0x43>
nop
add    $0x1,%rbp
add    $0xffffffff,%r13d
cmp    0x20(%rsp),%rbp
je     1241 <maxnormTriangle+0x121>
mov    %r14d,%r15d
sub    %ebp,%r15d
jle    1150 <maxnormTriangle+0x30>
cmp    $0x1,%r15d
jne    11c0 <maxnormTriangle+0xa0>
xor    %r12d,%r12d
test   $0x1,%r15b
mov    0x14(%rsp),%r14d
je     1150 <maxnormTriangle+0x30>
mov    (%rbx,%rbp,8),%rax
movsd  %xmm0,0x8(%rsp)
movsd  (%rax,%r12,8),%xmm0
call   1030 <abs@plt>
ucomisd 0x8(%rsp),%xmm0
movsd  0x8(%rsp),%xmm0
jbe    1150 <maxnormTriangle+0x30>
mov    (%rbx,%rbp,8),%rax
movsd  (%rax,%r12,8),%xmm0
call   1030 <abs@plt>
jmp    1150 <maxnormTriangle+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13d,%r14d
and    $0xfffffffe,%r14d
xor    %r12d,%r12d
jmp    11d9 <maxnormTriangle+0xb9>
nopl   0x0(%rax)
add    $0x2,%r12
cmp    %r12,%r14
je     1174 <maxnormTriangle+0x54>
movsd  %xmm0,0x8(%rsp)
mov    (%rbx,%rbp,8),%rax
movsd  (%rax,%r12,8),%xmm0
call   1030 <abs@plt>
ucomisd 0x8(%rsp),%xmm0
movsd  0x8(%rsp),%xmm0
jbe    120b <maxnormTriangle+0xeb>
mov    (%rbx,%rbp,8),%rax
movsd  (%rax,%r12,8),%xmm0
call   1030 <abs@plt>
movsd  %xmm0,0x8(%rsp)
mov    (%rbx,%rbp,8),%rax
movsd  0x8(%rax,%r12,8),%xmm0
call   1030 <abs@plt>
ucomisd 0x8(%rsp),%xmm0
movsd  0x8(%rsp),%xmm0
jbe    11d0 <maxnormTriangle+0xb0>
mov    (%rbx,%rbp,8),%rax
movsd  0x8(%rax,%r12,8),%xmm0
call   1030 <abs@plt>
jmp    11d0 <maxnormTriangle+0xb0>
lea    0xdb8(%rip),%rdi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%edx
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Max of %s(%d): %1.3e\0A\00"
define void @maxnormTriangle(double** %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca double**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
store double** %0, double*** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %12
12: ; preds = %52, %4
%13 = load i32, i32* %9
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %55
16: ; preds = %12
store i32 0, i32* %10
br label %17
17: ; preds = %48, %16
%18 = load i32, i32* %10
%19 = load i32, i32* %6
%20 = load i32, i32* %9
%21 = sub nsw i32 %19, %20
%22 = icmp slt i32 %18, %21
br i1 %22, label %23, label %51
23: ; preds = %17
%24 = load double, double* %11
%25 = load double**, double*** %5
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double*, double** %25, i64 %27
%29 = load double*, double** %28
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = call double @abs(double %33)
%35 = fcmp olt double %24, %34
br i1 %35, label %36, label %47
36: ; preds = %23
%37 = load double**, double*** %5
%38 = load i32, i32* %9
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double*, double** %37, i64 %39
%41 = load double*, double** %40
%42 = load i32, i32* %10
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
%45 = load double, double* %44
%46 = call double @abs(double %45)
store double %46, double* %11
br label %47
47: ; preds = %36, %23
br label %48
48: ; preds = %47
%49 = load i32, i32* %10
%50 = add nsw i32 %49, 1
store i32 %50, i32* %10
br label %17
51: ; preds = %17
br label %52
52: ; preds = %51
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
store i32 %54, i32* %9
br label %12
55: ; preds = %12
%56 = load i8*, i8** %7
%57 = load i32, i32* %8
%58 = load double, double* %11
%59 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %56, i32 %57, double %58)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Max of %s(%d): %1.3e\0A\00"
define void @maxnormTriangle(double** nocapture %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp sgt i32 %1, 0
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %4, %69
%8 = phi i64 [ 0, %4 ], [ %71, %69 ]
%9 = phi double [ undef, %4 ], [ %70, %69 ]
%10 = trunc i64 %8 to i32
%11 = sub i32 %1, %10
%12 = zext i32 %11 to i64
%13 = trunc i64 %8 to i32
%14 = icmp slt i32 %13, %1
br i1 %14, label %15, label %69
15: ; preds = %7
%16 = getelementptr inbounds double*, double** %0, i64 %8
%17 = and i64 %12, 1
%18 = icmp eq i32 %11, 1
br i1 %18, label %53, label %19
19: ; preds = %15
%20 = and i64 %12, 4294967294
br label %21
21: ; preds = %48, %19
%22 = phi i64 [ 0, %19 ], [ %50, %48 ]
%23 = phi double [ %9, %19 ], [ %49, %48 ]
%24 = phi i64 [ 0, %19 ], [ %51, %48 ]
%25 = load double*, double** %16
%26 = getelementptr inbounds double, double* %25, i64 %22
%27 = load double, double* %26
%28 = tail call double @abs(double %27)
%29 = fcmp olt double %23, %28
br i1 %29, label %30, label %35
30: ; preds = %21
%31 = load double*, double** %16
%32 = getelementptr inbounds double, double* %31, i64 %22
%33 = load double, double* %32
%34 = tail call double @abs(double %33)
br label %35
35: ; preds = %21, %30
%36 = phi double [ %34, %30 ], [ %23, %21 ]
%37 = or i64 %22, 1
%38 = load double*, double** %16
%39 = getelementptr inbounds double, double* %38, i64 %37
%40 = load double, double* %39
%41 = tail call double @abs(double %40)
%42 = fcmp olt double %36, %41
br i1 %42, label %43, label %48
43: ; preds = %35
%44 = load double*, double** %16
%45 = getelementptr inbounds double, double* %44, i64 %37
%46 = load double, double* %45
%47 = tail call double @abs(double %46)
br label %48
48: ; preds = %43, %35
%49 = phi double [ %47, %43 ], [ %36, %35 ]
%50 = add nuw nsw i64 %22, 2
%51 = add i64 %24, 2
%52 = icmp eq i64 %51, %20
br i1 %52, label %53, label %21
53: ; preds = %48, %15
%54 = phi double [ undef, %15 ], [ %49, %48 ]
%55 = phi i64 [ 0, %15 ], [ %50, %48 ]
%56 = phi double [ %9, %15 ], [ %49, %48 ]
%57 = icmp eq i64 %17, 0
br i1 %57, label %69, label %58
58: ; preds = %53
%59 = load double*, double** %16
%60 = getelementptr inbounds double, double* %59, i64 %55
%61 = load double, double* %60
%62 = tail call double @abs(double %61)
%63 = fcmp olt double %56, %62
br i1 %63, label %64, label %69
64: ; preds = %58
%65 = load double*, double** %16
%66 = getelementptr inbounds double, double* %65, i64 %55
%67 = load double, double* %66
%68 = tail call double @abs(double %67)
br label %69
69: ; preds = %53, %64, %58, %7
%70 = phi double [ %9, %7 ], [ %54, %53 ], [ %68, %64 ], [ %56, %58 ]
%71 = add nuw nsw i64 %8, 1
%72 = icmp eq i64 %71, %6
br i1 %72, label %73, label %7
73: ; preds = %69
%74 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3, double %70)
ret void
}