#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*/ corrigir(int **, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
void main() {
  int alunos[15][10], resultado[15], gabarito[10], i, j;
  for (i = 0; i < 15; i++)
    for (j = 0; j < 10; j++) {
      alunos[i][j] = 0;
      resultado[i] = 0;
      gabarito[j] = 0;
    }
  for (i = 0; i < 15; i++) {
    printf("\n");
    for (j = 0; j < 10; j++) {
      alunos[i][j] = (rand() % 5) + 1;
      if (i == 0)
        gabarito[i] = (rand() % 5) + 1;
    }
  }
  corrigir(alunos, gabarito, resultado);
  printf("Aluno %d: %d\n", i + 1, resultado[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2e0,%rsp
movl   $0x0,-0x2d4(%rbp)
cmpl   $0xf,-0x2d4(%rbp)
jge    11dd <main+0xad>
movl   $0x0,-0x2d8(%rbp)
cmpl   $0xa,-0x2d8(%rbp)
jge    11c4 <main+0x94>
movslq -0x2d4(%rbp),%rcx
lea    -0x260(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x2d8(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
movslq -0x2d4(%rbp),%rax
movl   $0x0,-0x2a0(%rbp,%rax,4)
movslq -0x2d8(%rbp),%rax
movl   $0x0,-0x2d0(%rbp,%rax,4)
mov    -0x2d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d8(%rbp)
jmp    115c <main+0x2c>
jmp    11c9 <main+0x99>
mov    -0x2d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d4(%rbp)
jmp    1145 <main+0x15>
movl   $0x0,-0x2d4(%rbp)
cmpl   $0xf,-0x2d4(%rbp)
jge    12a9 <main+0x179>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2d8(%rbp)
cmpl   $0xa,-0x2d8(%rbp)
jge    1290 <main+0x160>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
movslq -0x2d4(%rbp),%rcx
lea    -0x260(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x2d8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
cmpl   $0x0,-0x2d4(%rbp)
jne    1277 <main+0x147>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
movslq -0x2d4(%rbp),%rax
mov    %edx,-0x2d0(%rbp,%rax,4)
jmp    127c <main+0x14c>
mov    -0x2d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d8(%rbp)
jmp    120c <main+0xdc>
jmp    1295 <main+0x165>
mov    -0x2d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d4(%rbp)
jmp    11e7 <main+0xb7>
lea    -0x260(%rbp),%rdi
lea    -0x2d0(%rbp),%rsi
lea    -0x2a0(%rbp),%rdx
call   1040 <corrigir@plt>
mov    -0x2d4(%rbp),%esi
add    $0x1,%esi
movslq -0x2d4(%rbp),%rax
mov    -0x2a0(%rbp,%rax,4),%edx
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x2e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x2d0,%rsp
lea    0x70(%rsp),%r14
mov    $0x258,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movups %xmm0,0x5c(%rsp)
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
xor    %r15d,%r15d
jmp    11ae <main+0x5e>
xchg   %ax,%ax
add    $0x1,%r15
add    $0x28,%r14
cmp    $0xf,%r15
je     1227 <main+0xd7>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
jmp    11ca <main+0x7a>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    $0xa,%rbx
je     11a0 <main+0x50>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,(%r14,%rbx,4)
test   %r15,%r15
jne    11c0 <main+0x70>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,(%rsp,%r15,4)
jmp    11c0 <main+0x70>
lea    0x70(%rsp),%rdi
mov    %rsp,%rsi
lea    0x30(%rsp),%rdx
call   1060 <corrigir@plt>
mov    0x6c(%rsp),%edx
lea    0xdbc(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x2d0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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