#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 maior_valor_matriz(int **);
int /*<<< orphan*/ printf(char *);
void test_maior_valor_matriz() {
  printf("------------------------------------\n");
  printf("teste Q3: maior_valor_matriz.\n");
  int mat[4][4] = {{1, 2, 3, 4}, {4, 5, 6, 7}, {7, 8, 9, 10}, {10, 11, 12, 13}};
  if (maior_valor_matriz(mat) == 13) {
    printf("    ok.\n");
  } else {
    printf("    not ok.\n");
  }
}


x86 assembly (clang, -O0):
<test_maior_valor_matriz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    0xf05(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
call   1050 <maior_valor_matriz@plt>
cmp    $0xd,%eax
jne    1188 <test_maior_valor_matriz+0x58>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
jmp    1194 <test_maior_valor_matriz+0x64>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_maior_valor_matriz>:
sub    $0x48,%rsp
lea    0xf15(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2e(%rip),%rdi
call   1030 <puts@plt>
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe99(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <maior_valor_matriz@plt>
cmp    $0xd,%eax
lea    0xf12(%rip),%rax
lea    0xeff(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"------------------------------------\0A\00"
@.str.1 = [31 x i8] c"teste Q3: maior_valor_matriz.\0A\00"
@__const.test_maior_valor_matriz.mat = [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 4, i32 5, i32 6, i32 7], [4 x i32] [i32 7, i32 8, i32 9, i32 10], [4 x i32] [i32 10, i32 11, i32 12, i32 13]]
@.str.2 = [9 x i8] c" ok.\0A\00"
@.str.3 = [13 x i8] c" not ok.\0A\00"
define void @test_maior_valor_matriz() {
%1 = alloca [4 x [4 x i32]]
%2 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%4 = bitcast [4 x [4 x i32]]* %1 to i8*
%5 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0
%6 = bitcast [4 x i32]* %5 to i32**
%7 = call i32 @maior_valor_matriz(i32** %6)
%8 = icmp eq i32 %7, 13
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
ret void
}

LLVM IR (-O2):
@__const.test_maior_valor_matriz.mat = [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 4, i32 5, i32 6, i32 7], [4 x i32] [i32 7, i32 8, i32 9, i32 10], [4 x i32] [i32 10, i32 11, i32 12, i32 13]]
@str = [37 x i8] c"------------------------------------\00"
@str.4 = [30 x i8] c"teste Q3: maior_valor_matriz.\00"
@str.5 = [12 x i8] c" not ok.\00"
@str.6 = [8 x i8] c" ok.\00"
define void @test_maior_valor_matriz() {
%1 = alloca [4 x [4 x i32]]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0))
%4 = bitcast [4 x [4 x i32]]* %1 to i8*
%5 = bitcast [4 x [4 x i32]]* %1 to i32**
%6 = call i32 @maior_valor_matriz(i32** %5)
%7 = icmp eq i32 %6, 13
%8 = select i1 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0)
%9 = call i32 @puts(i8* dereferenceable(1) %8)
ret void
}