#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 fmaior(int **, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int i, j, mat[5][5], quant, x;
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 5; j++) {
      printf("Digite o elemento da linha %d e coluna %d: ", (i + 1), (j + 1));
      scanf("%d", &mat[i][j]);
    }
  }
  printf("Digite um número inteiro: ");
  scanf("%d", &x);
  quant = fmaior(mat, x);
  printf("\nO número %d esta prensente na matriz %d vezes.\n\n", x, quant);
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11d5 <main+0x95>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11c2 <main+0x82>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x70(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7d(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116a <main+0x2a>
jmp    11c7 <main+0x87>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1159 <main+0x19>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe42(%rip),%rdi
lea    -0x78(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%esi
call   1060 <fmaior@plt>
mov    %eax,-0x74(%rbp)
mov    -0x78(%rbp),%esi
mov    -0x74(%rbp),%edx
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe61(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    $0x1,%ebp
lea    0xeaa(%rip),%r14
lea    0xecf(%rip),%r15
xor    %ebx,%ebx
nop
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x14,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x18,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x1c,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
add    $0x14,%rbx
add    $0x1,%ebp
cmp    $0x64,%rbx
jne    1160 <main+0x20>
lea    0xe12(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe01(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rdi
call   1060 <fmaior@plt>
mov    0xc(%rsp),%esi
lea    0xdfd(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe20(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Digite o elemento da linha %d e coluna %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"Digite um n\C3\BAmero inteiro: \00"
@.str.3 = [51 x i8] c"\0AO n\C3\BAmero %d esta prensente na matriz %d vezes.\0A\0A\00"
@.str.4 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [5 x [5 x i32]]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %7
7: ; preds = %31, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %34
10: ; preds = %7
store i32 0, i32* %3
br label %11
11: ; preds = %27, %10
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 5
br i1 %13, label %14, label %30
14: ; preds = %11
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18)
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 %21
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 %24
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
br label %27
27: ; preds = %14
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %11
30: ; preds = %11
br label %31
31: ; preds = %30
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %7
34: ; preds = %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%37 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 0
%38 = bitcast [5 x i32]* %37 to i32**
%39 = load i32, i32* %6
%40 = call i32 @fmaior(i32** %38, i32 %39)
store i32 %40, i32* %5
%41 = load i32, i32* %6
%42 = load i32, i32* %5
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %42)
%44 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"Digite o elemento da linha %d e coluna %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"Digite um n\C3\BAmero inteiro: \00"
@.str.3 = [51 x i8] c"\0AO n\C3\BAmero %d esta prensente na matriz %d vezes.\0A\0A\00"
@.str.4 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [5 x [5 x i32]]
%2 = alloca i32
%3 = bitcast [5 x [5 x i32]]* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %7, %5 ]
%7 = add nuw nsw i64 %6, 1
%8 = trunc i64 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %8, i32 1)
%10 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %6, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %8, i32 2)
%13 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %6, i64 1
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %8, i32 3)
%16 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %6, i64 2
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %8, i32 4)
%19 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %6, i64 3
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %8, i32 5)
%22 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %6, i64 4
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = icmp eq i64 %7, 5
br i1 %24, label %25, label %5
25: ; preds = %5
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%28 = bitcast [5 x [5 x i32]]* %1 to i32**
%29 = load i32, i32* %2
%30 = call i32 @fmaior(i32** %28, i32 %29)
%31 = load i32, i32* %2
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %31, i32 %30)
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}