#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*/ printf(char *, ...);
void displayMax(int nums[10][20]) {
  int i = 0, maxVal = 0, max = nums[0][0];
  for (i = 0; i < 10; i++) {
    for (int j = 0; j < 20; ++j)
      if (maxVal < nums[i][j])
        maxVal = nums[i][j];
  }
  printf("\nThe maximum value is %d.", maxVal);
  printf("\nFrom our array:\n");
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 20; ++j) {
      printf("%3d", nums[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<displayMax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11b3 <displayMax+0xa3>
movl   $0x0,-0x18(%rbp)
cmpl   $0x14,-0x18(%rbp)
jge    11a0 <displayMax+0x90>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
movslq -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    118d <displayMax+0x7d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
jmp    1192 <displayMax+0x82>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <displayMax+0x3b>
jmp    11a5 <displayMax+0x95>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <displayMax+0x2a>
mov    -0x10(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    1242 <displayMax+0x132>
movl   $0x0,-0x20(%rbp)
cmpl   $0x14,-0x20(%rbp)
jge    1226 <displayMax+0x116>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ea <displayMax+0xda>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d9 <displayMax+0xc9>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayMax>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %esi,%esi
mov    $0x10,%eax
jmp    1165 <displayMax+0x35>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %esi,%edx
cmovg  %edx,%esi
add    $0x50,%rax
cmp    $0x330,%rax
je     1227 <displayMax+0xf7>
mov    -0x4(%r15,%rax,1),%ecx
movdqu 0x20(%r15,%rax,1),%xmm0
movdqu (%r15,%rax,1),%xmm1
movdqu 0x30(%r15,%rax,1),%xmm2
movdqu 0x10(%r15,%rax,1),%xmm3
movdqa %xmm3,%xmm4
pcmpgtd %xmm2,%xmm4
pand   %xmm4,%xmm3
pandn  %xmm2,%xmm4
por    %xmm3,%xmm4
movdqa %xmm1,%xmm2
pcmpgtd %xmm0,%xmm2
pand   %xmm2,%xmm1
pandn  %xmm0,%xmm2
por    %xmm1,%xmm2
movdqa %xmm2,%xmm0
pcmpgtd %xmm4,%xmm0
pand   %xmm0,%xmm2
pandn  %xmm4,%xmm0
por    %xmm2,%xmm0
pshufd $0xee,%xmm0,%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm0
pandn  %xmm1,%xmm2
por    %xmm0,%xmm2
pshufd $0x55,%xmm2,%xmm0
movdqa %xmm2,%xmm1
pcmpgtd %xmm0,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm0,%xmm1
por    %xmm2,%xmm1
movd   %xmm1,%edx
cmp    %ecx,%edx
jg     11fd <displayMax+0xcd>
mov    %ecx,%edx
mov    -0x8(%r15,%rax,1),%ecx
cmp    %ecx,%edx
jg     1208 <displayMax+0xd8>
mov    %ecx,%edx
mov    -0xc(%r15,%rax,1),%ecx
cmp    %ecx,%edx
jg     1213 <displayMax+0xe3>
mov    %ecx,%edx
mov    -0x10(%r15,%rax,1),%ecx
cmp    %ecx,%edx
jg     1150 <displayMax+0x20>
mov    %ecx,%edx
jmp    1150 <displayMax+0x20>
lea    0xdd2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xde2(%rip),%rdi
call   1040 <puts@plt>
mov    $0x4c,%ebx
lea    0xdcd(%rip),%r14
nopl   (%rax)
mov    -0x4c(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x48(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x44(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x40(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x3c(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x38(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x34(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x30(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x2c(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x28(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x24(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x20(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x1c(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x18(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x14(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x10(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0xc(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x8(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x4(%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x50,%rbx
cmp    $0x36c,%rbx
jne    1250 <displayMax+0x120>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [26 x i8] c"\0AThe maximum value is %d.\00"
@.str.2 = [4 x i8] c"%3d\00"
@str = [17 x i8] c"\0AFrom our array:\00"
define void @displayMax([20 x i32]* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %27, %2 ]
%4 = phi i32 [ 0, %1 ], [ %26, %2 ]
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %3, i64 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %3, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %3, i64 2
%10 = load i32, i32* %9
%11 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %3, i64 3
%12 = load i32, i32* %11
%13 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %3, i64 4
%14 = bitcast i32* %13 to <16 x i32>*
%15 = load <16 x i32>, <16 x i32>* %14
%16 = call i32 @llvm.vector.reduce.smax.v16i32(<16 x i32> %15)
%17 = icmp sgt i32 %16, %12
%18 = select i1 %17, i32 %16, i32 %12
%19 = icmp sgt i32 %18, %10
%20 = select i1 %19, i32 %18, i32 %10
%21 = icmp sgt i32 %20, %8
%22 = select i1 %21, i32 %20, i32 %8
%23 = icmp sgt i32 %22, %6
%24 = select i1 %23, i32 %22, i32 %6
%25 = icmp sgt i32 %24, %4
%26 = select i1 %25, i32 %24, i32 %4
%27 = add nuw nsw i64 %3, 1
%28 = icmp eq i64 %27, 10
br i1 %28, label %29, label %2
29: ; preds = %2
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %26)
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %32
32: ; preds = %29, %32
%33 = phi i64 [ 0, %29 ], [ %95, %32 ]
%34 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 0
%35 = load i32, i32* %34
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 1
%38 = load i32, i32* %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 2
%41 = load i32, i32* %40
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 3
%44 = load i32, i32* %43
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 4
%47 = load i32, i32* %46
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 5
%50 = load i32, i32* %49
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 6
%53 = load i32, i32* %52
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 7
%56 = load i32, i32* %55
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 8
%59 = load i32, i32* %58
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 9
%62 = load i32, i32* %61
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 10
%65 = load i32, i32* %64
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 11
%68 = load i32, i32* %67
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %68)
%70 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 12
%71 = load i32, i32* %70
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %71)
%73 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 13
%74 = load i32, i32* %73
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %74)
%76 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 14
%77 = load i32, i32* %76
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %77)
%79 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 15
%80 = load i32, i32* %79
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %80)
%82 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 16
%83 = load i32, i32* %82
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %83)
%85 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 17
%86 = load i32, i32* %85
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %86)
%88 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 18
%89 = load i32, i32* %88
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %89)
%91 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %33, i64 19
%92 = load i32, i32* %91
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %92)
%94 = tail call i32 @putchar(i32 10)
%95 = add nuw nsw i64 %33, 1
%96 = icmp eq i64 %95, 10
br i1 %96, label %97, label %32
97: ; preds = %32
ret void
}