#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*/ __fpurge(int /*<<< orphan*/);
int /*<<< orphan*/ geraArquivoSudokuCompleto();
int /*<<< orphan*/ geraArquivoSudokuModelo();
int /*<<< orphan*/ geraArquivoeImprimeSudoku();
int /*<<< orphan*/ geraSudoku();
int /*<<< orphan*/ imprimeSudokuCompleto();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ system(char *);
int main() {
  system("clear");
  puts("\n");
  puts("--------------------------------------------------");
  puts("--------------------- SUDOKU ---------------------");
  puts("--------------------------------------------------");
  puts("Thiago Medeiros");
  puts("\n");
  char op;
  do {
    puts("Entre com uma opção:");
    puts("1. Gerar sudoku (arquivo será criado automaticamente).");
    puts("2. Solução sudoku (arquivo será criado automaticamente).");
    puts("\n");
    puts("---");
    puts("'X' - SAIR\n");
    __fpurge(stdin);
    scanf("%c", &op);
    switch (op) {
    case '1':
      system("clear");
      geraSudoku();
      geraArquivoSudokuModelo();
      geraArquivoeImprimeSudoku();
      break;
    case '2':
      system("clear");
      imprimeSudokuCompleto();
      geraArquivoSudokuCompleto();
      break;
    case 'X':
      return 0;
    case 'x':
      return 0;
    default:
      system("clear");
      puts("ERRO: Opção inválida.\n");
      break;
    }
  } while (op != 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe5a(%rip),%rdi
call   1060 <system@plt>
lea    0xf7c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe48(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe30(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf40(%rip),%rdi
call   1030 <puts@plt>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3e(%rip),%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
call   1040 <__fpurge@plt>
lea    0xec3(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   10a0 <scanf@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x31,%eax
je     12a1 <main+0x111>
jmp    126e <main+0xde>
mov    -0xc(%rbp),%eax
sub    $0x32,%eax
je     12c7 <main+0x137>
jmp    127f <main+0xef>
mov    -0xc(%rbp),%eax
sub    $0x58,%eax
je     12e6 <main+0x156>
jmp    1290 <main+0x100>
mov    -0xc(%rbp),%eax
sub    $0x78,%eax
je     12f2 <main+0x162>
jmp    12fe <main+0x16e>
lea    0xd58(%rip),%rdi
call   1060 <system@plt>
mov    $0x0,%al
call   10b0 <geraSudoku@plt>
mov    $0x0,%al
call   1090 <geraArquivoSudokuModelo@plt>
mov    $0x0,%al
call   1070 <geraArquivoeImprimeSudoku@plt>
jmp    1316 <main+0x186>
lea    0xd32(%rip),%rdi
call   1060 <system@plt>
mov    $0x0,%al
call   1080 <imprimeSudokuCompleto@plt>
mov    $0x0,%al
call   1050 <geraArquivoSudokuCompleto@plt>
jmp    1316 <main+0x186>
movl   $0x0,-0x4(%rbp)
jmp    132f <main+0x19f>
movl   $0x0,-0x4(%rbp)
jmp    132f <main+0x19f>
lea    0xcfb(%rip),%rdi
call   1060 <system@plt>
lea    0xe05(%rip),%rdi
call   1030 <puts@plt>
jmp    131b <main+0x18b>
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
jne    11f3 <main+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe5e(%rip),%rdi
call   1060 <system@plt>
lea    0xf80(%rip),%rbp
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xe49(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xed7(%rip),%rbx
lea    0xe6d(%rip),%rbp
lea    0xf05(%rip),%r14
mov    0x2ddf(%rip),%r13
lea    0xf03(%rip),%r15
lea    0x7(%rsp),%r12
jmp    1243 <main+0xb3>
nopw   0x0(%rax,%rax,1)
lea    0xdd9(%rip),%rdi
call   1060 <system@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
cmpb   $0x0,0x7(%rsp)
je     130a <main+0x17a>
lea    0xe32(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    0x0(%r13),%edi
call   1040 <__fpurge@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   10a0 <scanf@plt>
movsbl 0x7(%rsp),%eax
cmp    $0x31,%eax
jle    12d0 <main+0x140>
cmp    $0x32,%eax
jne    12fc <main+0x16c>
lea    0xd57(%rip),%rdi
call   1060 <system@plt>
xor    %eax,%eax
call   1080 <imprimeSudokuCompleto@plt>
xor    %eax,%eax
call   1050 <geraArquivoSudokuCompleto@plt>
jmp    1238 <main+0xa8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jne    1220 <main+0x90>
lea    0xd23(%rip),%rdi
call   1060 <system@plt>
xor    %eax,%eax
call   10b0 <geraSudoku@plt>
xor    %eax,%eax
call   1090 <geraArquivoSudokuModelo@plt>
xor    %eax,%eax
call   1070 <geraArquivoeImprimeSudoku@plt>
jmp    1238 <main+0xa8>
cmp    $0x58,%eax
je     130a <main+0x17a>
cmp    $0x78,%eax
jne    1220 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [51 x i8] c"--------------------------------------------------\00"
@.str.3 = [51 x i8] c"--------------------- SUDOKU ---------------------\00"
@.str.4 = [16 x i8] c"Thiago Medeiros\00"
@.str.5 = [23 x i8] c"Entre com uma op\C3\A7\C3\A3o:\00"
@.str.6 = [56 x i8] c"1. Gerar sudoku (arquivo ser\C3\A1 criado automaticamente).\00"
@.str.7 = [60 x i8] c"2. Solu\C3\A7\C3\A3o sudoku (arquivo ser\C3\A1 criado automaticamente).\00"
@.str.8 = [4 x i8] c"---\00"
@.str.9 = [12 x i8] c"'X' - SAIR\0A\00"
@stdin = global i32 0
@.str.10 = [3 x i8] c"%c\00"
@.str.11 = [26 x i8] c"ERRO: Op\C3\A7\C3\A3o inv\C3\A1lida.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %37, %0
%11 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @puts(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @puts(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%16 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%17 = load i32, i32* @stdin
%18 = call i32 @__fpurge(i32 %17)
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %2)
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
switch i32 %21, label %33 [
i32 49, label %22
i32 50, label %27
i32 88, label %31
i32 120, label %32
]
22: ; preds = %10
%23 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%24 = call i32 (...) @geraSudoku()
%25 = call i32 (...) @geraArquivoSudokuModelo()
%26 = call i32 (...) @geraArquivoeImprimeSudoku()
br label %36
27: ; preds = %10
%28 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%29 = call i32 (...) @imprimeSudokuCompleto()
%30 = call i32 (...) @geraArquivoSudokuCompleto()
br label %36
31: ; preds = %10
store i32 0, i32* %1
br label %42
32: ; preds = %10
store i32 0, i32* %1
br label %42
33: ; preds = %10
%34 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%35 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
br label %36
36: ; preds = %33, %27, %22
br label %37
37: ; preds = %36
%38 = load i8, i8* %2
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %39, 0
br i1 %40, label %10, label %41
41: ; preds = %37
store i32 0, i32* %1
br label %42
42: ; preds = %41, %32, %31
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [51 x i8] c"--------------------------------------------------\00"
@.str.3 = [51 x i8] c"--------------------- SUDOKU ---------------------\00"
@.str.4 = [16 x i8] c"Thiago Medeiros\00"
@.str.5 = [23 x i8] c"Entre com uma op\C3\A7\C3\A3o:\00"
@.str.6 = [56 x i8] c"1. Gerar sudoku (arquivo ser\C3\A1 criado automaticamente).\00"
@.str.7 = [60 x i8] c"2. Solu\C3\A7\C3\A3o sudoku (arquivo ser\C3\A1 criado automaticamente).\00"
@.str.8 = [4 x i8] c"---\00"
@.str.9 = [12 x i8] c"'X' - SAIR\0A\00"
@stdin = global i32 0
@.str.10 = [3 x i8] c"%c\00"
@.str.11 = [26 x i8] c"ERRO: Op\C3\A7\C3\A3o inv\C3\A1lida.\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %33, %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%16 = load i32, i32* @stdin
%17 = call i32 @__fpurge(i32 %16)
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %1)
%19 = load i8, i8* %1
%20 = sext i8 %19 to i32
switch i32 %20, label %30 [
i32 49, label %21
i32 50, label %26
i32 88, label %36
i32 120, label %36
]
21: ; preds = %9
%22 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%23 = call i32 (...) @geraSudoku()
%24 = call i32 (...) @geraArquivoSudokuModelo()
%25 = call i32 (...) @geraArquivoeImprimeSudoku()
br label %33
26: ; preds = %9
%27 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%28 = call i32 (...) @imprimeSudokuCompleto()
%29 = call i32 (...) @geraArquivoSudokuCompleto()
br label %33
30: ; preds = %9
%31 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
br label %33
33: ; preds = %21, %26, %30
%34 = load i8, i8* %1
%35 = icmp eq i8 %34, 0
br i1 %35, label %36, label %9
36: ; preds = %33, %9, %9
ret i32 0
}