#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 h1(int **);
int h2(int **);
int h3(int **);
int h5(int m[4][4]) {
  int answer;
  int r1 = h1(m);
  int r2 = h2(m);
  int r3 = h3(m);
  if (r1 > r2) {
    if (r1 > r3) {
      answer = r1;
    } else {
      answer = r3;
    }
  } else {
    if (r2 > r3) {
      answer = r2;
    } else {
      answer = r3;
    }
  }
  return answer;
}


x86 assembly (clang, -O0):
<h5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <h1@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <h2@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <h3@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    118e <h5+0x5e>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1183 <h5+0x53>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1189 <h5+0x59>
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11b0 <h5+0x80>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11a5 <h5+0x75>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11ab <h5+0x7b>
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11b0 <h5+0x80>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h5>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1050 <h1@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1030 <h2@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <h3@plt>
cmp    %eax,%r14d
cmovg  %r14d,%eax
cmp    %ebp,%eax
cmovle %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @h5([4 x i32]* %0) {
%2 = alloca [4 x i32]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store [4 x i32]* %0, [4 x i32]** %2
%7 = load [4 x i32]*, [4 x i32]** %2
%8 = bitcast [4 x i32]* %7 to i32**
%9 = call i32 @h1(i32** %8)
store i32 %9, i32* %4
%10 = load [4 x i32]*, [4 x i32]** %2
%11 = bitcast [4 x i32]* %10 to i32**
%12 = call i32 @h2(i32** %11)
store i32 %12, i32* %5
%13 = load [4 x i32]*, [4 x i32]** %2
%14 = bitcast [4 x i32]* %13 to i32**
%15 = call i32 @h3(i32** %14)
store i32 %15, i32* %6
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %28
19: ; preds = %1
%20 = load i32, i32* %4
%21 = load i32, i32* %6
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i32, i32* %4
store i32 %24, i32* %3
br label %27
25: ; preds = %19
%26 = load i32, i32* %6
store i32 %26, i32* %3
br label %27
27: ; preds = %25, %23
br label %37
28: ; preds = %1
%29 = load i32, i32* %5
%30 = load i32, i32* %6
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = load i32, i32* %5
store i32 %33, i32* %3
br label %36
34: ; preds = %28
%35 = load i32, i32* %6
store i32 %35, i32* %3
br label %36
36: ; preds = %34, %32
br label %37
37: ; preds = %36, %27
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
define i32 @h5([4 x i32]* %0) {
%2 = bitcast [4 x i32]* %0 to i32**
%3 = tail call i32 @h1(i32** %2)
%4 = tail call i32 @h2(i32** %2)
%5 = tail call i32 @h3(i32** %2)
%6 = icmp sgt i32 %3, %5
%7 = select i1 %6, i32 %3, i32 %5
%8 = icmp sgt i32 %7, %4
%9 = select i1 %8, i32 %7, i32 %4
ret i32 %9
}