#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*/ ler_matriz(int **);
int maior_elemento(int **);
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int matriz[50][50], i, j;
  int maior;
  ler_matriz(matriz);
  maior = maior_elemento(matriz);
  for (i = 0; i < 50; i++) {
    matriz[i][i] *= maior;
  }
  for (i = 0; i < 50; i++) {
    for (j = 0; j < 50; j++) {
      printf("%d ", matriz[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2720,%rsp
lea    -0x2710(%rbp),%rdi
call   1050 <ler_matriz@plt>
lea    -0x2710(%rbp),%rdi
call   1040 <maior_elemento@plt>
mov    %eax,-0x271c(%rbp)
movl   $0x0,-0x2714(%rbp)
cmpl   $0x32,-0x2714(%rbp)
jge    11b0 <main+0x80>
mov    -0x271c(%rbp),%edx
movslq -0x2714(%rbp),%rcx
lea    -0x2710(%rbp),%rax
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x2714(%rbp),%rcx
imul   (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x2714(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2714(%rbp)
jmp    1163 <main+0x33>
movl   $0x0,-0x2714(%rbp)
cmpl   $0x32,-0x2714(%rbp)
jge    1244 <main+0x114>
movl   $0x0,-0x2718(%rbp)
cmpl   $0x32,-0x2718(%rbp)
jge    1222 <main+0xf2>
movslq -0x2714(%rbp),%rcx
lea    -0x2710(%rbp),%rax
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x2718(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2718(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2718(%rbp)
jmp    11d1 <main+0xa1>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2714(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2714(%rbp)
jmp    11ba <main+0x8a>
add    $0x2720,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x2718,%rsp
mov    %rsp,%r12
mov    %r12,%rdi
call   1060 <ler_matriz@plt>
mov    %r12,%rdi
call   1050 <maior_elemento@plt>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rsp,%rcx,1),%edx
imul   %eax,%edx
mov    %edx,(%rsp,%rcx,1)
mov    0xcc(%rsp,%rcx,1),%edx
imul   %eax,%edx
mov    %edx,0xcc(%rsp,%rcx,1)
add    $0x198,%rcx
cmp    $0x27d8,%rcx
jne    1170 <main+0x30>
lea    0xe5f(%rip),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x32,%rbx
jne    11c0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
add    $0xc8,%r12
cmp    $0x32,%r15
jne    11b0 <main+0x70>
add    $0x2718,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca [50 x [50 x i32]]
%2 = bitcast [50 x [50 x i32]]* %1 to i8*
%3 = bitcast [50 x [50 x i32]]* %1 to i32**
%4 = call i32 @ler_matriz(i32** %3)
%5 = call i32 @maior_elemento(i32** %3)
br label %6
6: ; preds = %6, %0
%7 = phi i64 [ 0, %0 ], [ %15, %6 ]
%8 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 %7, i64 %7
%9 = load i32, i32* %8
%10 = mul nsw i32 %9, %5
store i32 %10, i32* %8
%11 = or i64 %7, 1
%12 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 %11, i64 %11
%13 = load i32, i32* %12
%14 = mul nsw i32 %13, %5
store i32 %14, i32* %12
%15 = add nuw nsw i64 %7, 2
%16 = icmp eq i64 %15, 50
br i1 %16, label %17, label %6
17: ; preds = %6, %26
%18 = phi i64 [ %28, %26 ], [ 0, %6 ]
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ 0, %17 ], [ %24, %19 ]
%21 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 %18, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = add nuw nsw i64 %20, 1
%25 = icmp eq i64 %24, 50
br i1 %25, label %26, label %19
26: ; preds = %19
%27 = call i32 @putchar(i32 10)
%28 = add nuw nsw i64 %18, 1
%29 = icmp eq i64 %28, 50
br i1 %29, label %30, label %17
30: ; preds = %26
ret void
}