#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 */
typedef int /*<<< orphan*/ caminho;

/* Variables and functions */
scalar_t__ carregaArquivo(char *, int *, int *);
int /*<<< orphan*/ desalocaMatriz(int **, int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ inverter(int **, int, int);
int /*<<< orphan*/ limiarizar(int **, int, int);
int /*<<< orphan*/ media3x3(int **, int, int);
int /*<<< orphan*/ mediana3x3(int **, int, int);
int /*<<< orphan*/ mostraMatriz(int **, int, int);
int /*<<< orphan*/ mostraUso();
int nroBrancos(int **, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ salvaArquivo(char *, int **, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ teclaEnter();
int main(int argc, char **argv) {
  if (!argv[1]) {
    mostraUso();
    return 0;
  }
  int **matriz;
  int linhas, colunas;
  printf("Abrindo arquivo...\n");
  matriz = (int **)carregaArquivo(argv[1], &linhas, &colunas);
  if (!matriz) {
    printf("ERRO: nao foi possivel abrir o arquivo %s\n", argv[1]);
    return 0;
  }
  int opcao;
  do {
    system("clear");
    printf("Selecione uma opcao ou 0 para encerrar\n"
           "[1] - Salvar\n"
           "[2] - Limiarizar\n"
           "[3] - Inverter\n"
           "[4] - Media 3x3\n"
           "[5] - Mediana 3x3\n"
           "[6] - Numero de brancos\n"
           "======> ");
    scanf("%d", &opcao);
    switch (opcao) {
    case 0:
      break;
    case 1:
      printf("\nNome do novo arquivo (enter para sobrescrever): ");
      char caminho[20];
      getchar();
      fgets(caminho, sizeof(caminho), stdin);
      if (caminho)
        salvaArquivo(caminho, matriz, linhas, colunas);
      else
        salvaArquivo(argv[1], matriz, linhas, colunas);
      teclaEnter();
      break;
    case 2:
      limiarizar(matriz, linhas, colunas);
      mostraMatriz(matriz, linhas, colunas);
      break;
    case 3:
      inverter(matriz, linhas, colunas);
      mostraMatriz(matriz, linhas, colunas);
      break;
    case 4:
      if (media3x3(matriz, linhas, colunas))
        mostraMatriz(matriz, linhas, colunas);
      break;
    case 5:
      if (mediana3x3(matriz, linhas, colunas))
        mostraMatriz(matriz, linhas, colunas);
      break;
    case 6:
      printf("\nNumero de brancos: %d\n", nroBrancos(matriz, linhas, colunas));
      teclaEnter();
      break;
    default:
      printf("Opcao nao reconhecida");
      teclaEnter();
      break;
    }
  } while (opcao != 0);
  desalocaMatriz(matriz, linhas);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    1238 <main+0x38>
mov    $0x0,%al
call   1120 <mostraUso@plt>
movl   $0x0,-0x4(%rbp)
jmp    145a <main+0x25a>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1100 <carregaArquivo@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    128c <main+0x8c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    145a <main+0x25a>
jmp    1291 <main+0x91>
lea    0xdc3(%rip),%rdi
call   1070 <system@plt>
lea    0xdbd(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe46(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1110 <scanf@plt>
mov    -0x24(%rbp),%eax
mov    %rax,-0x48(%rbp)
sub    $0x6,%rax
ja     1423 <main+0x223>
mov    -0x48(%rbp),%rax
lea    0xd29(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1438 <main+0x238>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x0,%al
call   10c0 <getchar@plt>
lea    -0x40(%rbp),%rdi
mov    0x2ce3(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   10b0 <fgets@plt>
lea    -0x40(%rbp),%rax
cmp    $0x0,%rax
je     1337 <main+0x137>
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1090 <salvaArquivo@plt>
jmp    134e <main+0x14e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1090 <salvaArquivo@plt>
mov    $0x0,%al
call   10a0 <teclaEnter@plt>
jmp    1438 <main+0x238>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1050 <limiarizar@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   10f0 <mostraMatriz@plt>
jmp    1438 <main+0x238>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <inverter@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   10f0 <mostraMatriz@plt>
jmp    1438 <main+0x238>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1030 <media3x3@plt>
cmp    $0x0,%eax
je     13c7 <main+0x1c7>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   10f0 <mostraMatriz@plt>
jmp    1438 <main+0x238>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   10d0 <mediana3x3@plt>
cmp    $0x0,%eax
je     13f3 <main+0x1f3>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   10f0 <mostraMatriz@plt>
jmp    1438 <main+0x238>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1060 <nroBrancos@plt>
mov    %eax,%esi
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x0,%al
call   10a0 <teclaEnter@plt>
jmp    1438 <main+0x238>
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x0,%al
call   10a0 <teclaEnter@plt>
jmp    143d <main+0x23d>
cmpl   $0x0,-0x24(%rbp)
jne    1291 <main+0x91>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10e0 <desalocaMatriz@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmpq   $0x0,0x8(%rsi)
je     13d8 <main+0x1c8>
mov    %rsi,%rbp
lea    0xf14(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rbp),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1110 <carregaArquivo@plt>
test   %rax,%rax
je     13e1 <main+0x1d1>
mov    %rax,%r15
lea    0xde9(%rip),%rbp
lea    0xde8(%rip),%r14
lea    0xe78(%rip),%r12
lea    0x14(%rsp),%rbx
lea    0xd88(%rip),%r13
mov    %rax,0x18(%rsp)
jmp    129f <main+0x8f>
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %eax,%eax
call   10b0 <teclaEnter@plt>
cmpl   $0x0,0x14(%rsp)
je     13ca <main+0x1ba>
mov    %rbp,%rdi
call   1080 <system@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1120 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x6,%rax
ja     127f <main+0x6f>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %eax,%eax
call   10d0 <getchar@plt>
mov    0x2cfc(%rip),%rax
mov    (%rax),%edx
mov    %r13,%r15
mov    %r12,%r13
mov    %r14,%r12
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x14,%esi
call   10c0 <fgets@plt>
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    %r14,%rdi
mov    %r12,%r14
mov    %r13,%r12
mov    %r15,%r13
mov    0x18(%rsp),%r15
mov    %r15,%rsi
call   10a0 <salvaArquivo@plt>
jmp    128d <main+0x7d>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r15,%rdi
call   1060 <limiarizar@plt>
jmp    1390 <main+0x180>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r15,%rdi
call   1050 <inverter@plt>
jmp    1390 <main+0x180>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r15,%rdi
call   1030 <media3x3@plt>
test   %eax,%eax
jne    1390 <main+0x180>
jmp    1294 <main+0x84>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r15,%rdi
call   10e0 <mediana3x3@plt>
test   %eax,%eax
je     1294 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r15,%rdi
call   1100 <mostraMatriz@plt>
jmp    1294 <main+0x84>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r15,%rdi
call   1070 <nroBrancos@plt>
lea    0xd5d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    128d <main+0x7d>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   10f0 <desalocaMatriz@plt>
jmp    13f3 <main+0x1e3>
xor    %eax,%eax
call   1130 <mostraUso@plt>
jmp    13f3 <main+0x1e3>
mov    0x8(%rbp),%rsi
lea    0xc30(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Abrindo arquivo...\0A\00"
@.str.1 = [43 x i8] c"ERRO: nao foi possivel abrir o arquivo %s\0A\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [151 x i8] c"Selecione uma opcao ou 0 para encerrar\0A[1] - Salvar\0A[2] - Limiarizar\0A[3] - Inverter\0A[4] - Media 3x3\0A[5] - Mediana 3x3\0A[6] - Numero de brancos\0A======> \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [50 x i8] c"\0ANome do novo arquivo (enter para sobrescrever): \00"
@stdin = global i32 0
@.str.6 = [24 x i8] c"\0ANumero de brancos: %d\0A\00"
@.str.7 = [22 x i8] c"Opcao nao reconhecida\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [20 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = icmp ne i8* %13, null
br i1 %14, label %17, label %15
15: ; preds = %2
%16 = call i32 (...) @mostraUso()
store i32 0, i32* %3
br label %122
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i64 @carregaArquivo(i8* %21, i32* %7, i32* %8)
%23 = inttoptr i64 %22 to i32**
store i32** %23, i32*** %6
%24 = load i32**, i32*** %6
%25 = icmp ne i32** %24, null
br i1 %25, label %31, label %26
26: ; preds = %17
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %29)
store i32 0, i32* %3
br label %122
31: ; preds = %17
br label %32
32: ; preds = %115, %31
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %9)
%36 = load i32, i32* %9
switch i32 %36, label %111 [
i32 0, label %37
i32 1, label %38
i32 2, label %62
i32 3, label %71
i32 4, label %80
i32 5, label %92
i32 6, label %104
]
37: ; preds = %32
br label %114
38: ; preds = %32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%40 = call i32 (...) @getchar()
%41 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%42 = load i32, i32* @stdin
%43 = call i32 @fgets(i8* %41, i32 20, i32 %42)
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %52
46: ; preds = %38
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%48 = load i32**, i32*** %6
%49 = load i32, i32* %7
%50 = load i32, i32* %8
%51 = call i32 @salvaArquivo(i8* %47, i32** %48, i32 %49, i32 %50)
br label %60
52: ; preds = %38
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 1
%55 = load i8*, i8** %54
%56 = load i32**, i32*** %6
%57 = load i32, i32* %7
%58 = load i32, i32* %8
%59 = call i32 @salvaArquivo(i8* %55, i32** %56, i32 %57, i32 %58)
br label %60
60: ; preds = %52, %46
%61 = call i32 (...) @teclaEnter()
br label %114
62: ; preds = %32
%63 = load i32**, i32*** %6
%64 = load i32, i32* %7
%65 = load i32, i32* %8
%66 = call i32 @limiarizar(i32** %63, i32 %64, i32 %65)
%67 = load i32**, i32*** %6
%68 = load i32, i32* %7
%69 = load i32, i32* %8
%70 = call i32 @mostraMatriz(i32** %67, i32 %68, i32 %69)
br label %114
71: ; preds = %32
%72 = load i32**, i32*** %6
%73 = load i32, i32* %7
%74 = load i32, i32* %8
%75 = call i32 @inverter(i32** %72, i32 %73, i32 %74)
%76 = load i32**, i32*** %6
%77 = load i32, i32* %7
%78 = load i32, i32* %8
%79 = call i32 @mostraMatriz(i32** %76, i32 %77, i32 %78)
br label %114
80: ; preds = %32
%81 = load i32**, i32*** %6
%82 = load i32, i32* %7
%83 = load i32, i32* %8
%84 = call i32 @media3x3(i32** %81, i32 %82, i32 %83)
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %91
86: ; preds = %80
%87 = load i32**, i32*** %6
%88 = load i32, i32* %7
%89 = load i32, i32* %8
%90 = call i32 @mostraMatriz(i32** %87, i32 %88, i32 %89)
br label %91
91: ; preds = %86, %80
br label %114
92: ; preds = %32
%93 = load i32**, i32*** %6
%94 = load i32, i32* %7
%95 = load i32, i32* %8
%96 = call i32 @mediana3x3(i32** %93, i32 %94, i32 %95)
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %103
98: ; preds = %92
%99 = load i32**, i32*** %6
%100 = load i32, i32* %7
%101 = load i32, i32* %8
%102 = call i32 @mostraMatriz(i32** %99, i32 %100, i32 %101)
br label %103
103: ; preds = %98, %92
br label %114
104: ; preds = %32
%105 = load i32**, i32*** %6
%106 = load i32, i32* %7
%107 = load i32, i32* %8
%108 = call i32 @nroBrancos(i32** %105, i32 %106, i32 %107)
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 %108)
%110 = call i32 (...) @teclaEnter()
br label %114
111: ; preds = %32
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%113 = call i32 (...) @teclaEnter()
br label %114
114: ; preds = %111, %104, %103, %91, %71, %62, %60, %37
br label %115
115: ; preds = %114
%116 = load i32, i32* %9
%117 = icmp ne i32 %116, 0
br i1 %117, label %32, label %118
118: ; preds = %115
%119 = load i32**, i32*** %6
%120 = load i32, i32* %7
%121 = call i32 @desalocaMatriz(i32** %119, i32 %120)
store i32 0, i32* %3
br label %122
122: ; preds = %118, %26, %15
%123 = load i32, i32* %3
ret i32 %123
}

LLVM IR (-O2):
@.str.1 = [43 x i8] c"ERRO: nao foi possivel abrir o arquivo %s\0A\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [151 x i8] c"Selecione uma opcao ou 0 para encerrar\0A[1] - Salvar\0A[2] - Limiarizar\0A[3] - Inverter\0A[4] - Media 3x3\0A[5] - Mediana 3x3\0A[6] - Numero de brancos\0A======> \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [50 x i8] c"\0ANome do novo arquivo (enter para sobrescrever): \00"
@stdin = global i32 0
@.str.6 = [24 x i8] c"\0ANumero de brancos: %d\0A\00"
@.str.7 = [22 x i8] c"Opcao nao reconhecida\00"
@str = [19 x i8] c"Abrindo arquivo...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [20 x i8]
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @mostraUso()
br label %88
12: ; preds = %2
%13 = bitcast i32* %3 to i8*
%14 = bitcast i32* %4 to i8*
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%16 = load i8*, i8** %7
%17 = call i64 @carregaArquivo(i8* %16, i32* %3, i32* %4)
%18 = inttoptr i64 %17 to i32**
%19 = icmp eq i64 %17, 0
br i1 %19, label %20, label %23
20: ; preds = %12
%21 = load i8*, i8** %7
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %21)
br label %87
23: ; preds = %12
%24 = bitcast i32* %5 to i8*
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
br label %26
26: ; preds = %81, %23
%27 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([151 x i8], [151 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%30 = load i32, i32* %5
switch i32 %30, label %78 [
i32 0, label %84
i32 1, label %31
i32 2, label %40
i32 3, label %47
i32 4, label %54
i32 5, label %63
i32 6, label %72
]
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%33 = call i32 (...) @getchar()
%34 = load i32, i32* @stdin
%35 = call i32 @fgets(i8* %25, i32 20, i32 %34)
%36 = load i32, i32* %3
%37 = load i32, i32* %4
%38 = call i32 @salvaArquivo(i8* %25, i32** %18, i32 %36, i32 %37)
%39 = call i32 (...) @teclaEnter()
br label %81
40: ; preds = %26
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = call i32 @limiarizar(i32** %18, i32 %41, i32 %42)
%44 = load i32, i32* %3
%45 = load i32, i32* %4
%46 = call i32 @mostraMatriz(i32** %18, i32 %44, i32 %45)
br label %81
47: ; preds = %26
%48 = load i32, i32* %3
%49 = load i32, i32* %4
%50 = call i32 @inverter(i32** %18, i32 %48, i32 %49)
%51 = load i32, i32* %3
%52 = load i32, i32* %4
%53 = call i32 @mostraMatriz(i32** %18, i32 %51, i32 %52)
br label %81
54: ; preds = %26
%55 = load i32, i32* %3
%56 = load i32, i32* %4
%57 = call i32 @media3x3(i32** %18, i32 %55, i32 %56)
%58 = icmp eq i32 %57, 0
br i1 %58, label %81, label %59
59: ; preds = %54
%60 = load i32, i32* %3
%61 = load i32, i32* %4
%62 = call i32 @mostraMatriz(i32** %18, i32 %60, i32 %61)
br label %81
63: ; preds = %26
%64 = load i32, i32* %3
%65 = load i32, i32* %4
%66 = call i32 @mediana3x3(i32** %18, i32 %64, i32 %65)
%67 = icmp eq i32 %66, 0
br i1 %67, label %81, label %68
68: ; preds = %63
%69 = load i32, i32* %3
%70 = load i32, i32* %4
%71 = call i32 @mostraMatriz(i32** %18, i32 %69, i32 %70)
br label %81
72: ; preds = %26
%73 = load i32, i32* %3
%74 = load i32, i32* %4
%75 = call i32 @nroBrancos(i32** %18, i32 %73, i32 %74)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 %75)
%77 = call i32 (...) @teclaEnter()
br label %81
78: ; preds = %26
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%80 = call i32 (...) @teclaEnter()
br label %81
81: ; preds = %31, %40, %47, %72, %78, %59, %54, %68, %63
%82 = load i32, i32* %5
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %26
84: ; preds = %26, %81
%85 = load i32, i32* %3
%86 = call i32 @desalocaMatriz(i32** %18, i32 %85)
br label %87
87: ; preds = %84, %20
br label %88
88: ; preds = %87, %10
ret i32 0
}