#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*/ escreve_matriz(int **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void ascu(char c, int *valor, int complete[9][9]) {
  switch (c) {
  case 49:
    *valor = 1;
    break;
  case 50:
    *valor = 2;
    break;
  case 51:
    *valor = 3;
    break;
  case 52:
    *valor = 4;
    break;
  case 53:
    *valor = 5;
    break;
  case 54:
    *valor = 6;
    break;
  case 55:
    *valor = 7;
    break;
  case 56:
    *valor = 8;
    break;
  case 57:
    *valor = 9;
    break;
  case 113:
    printf("\n\nJogo finalizado\n\n");
    exit(1);
  case 99:
    escreve_matriz(complete);
    exit(1);
  default:
    printf("Caractere invalido. Nao sabe contar ate 9?\n\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<ascu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x40,%eax
ja     1220 <ascu+0xf0>
mov    -0x20(%rbp),%rax
lea    0xe99(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    1236 <ascu+0x106>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
jmp    1236 <ascu+0x106>
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
jmp    1236 <ascu+0x106>
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
jmp    1236 <ascu+0x106>
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
jmp    1236 <ascu+0x106>
mov    -0x10(%rbp),%rax
movl   $0x6,(%rax)
jmp    1236 <ascu+0x106>
mov    -0x10(%rbp),%rax
movl   $0x7,(%rax)
jmp    1236 <ascu+0x106>
mov    -0x10(%rbp),%rax
movl   $0x8,(%rax)
jmp    1236 <ascu+0x106>
mov    -0x10(%rbp),%rax
movl   $0x9,(%rax)
jmp    1236 <ascu+0x106>
lea    0xf06(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1030 <escreve_matriz@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xef1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascu>:
push   %rax
add    $0xffffffcf,%edi
cmp    $0x40,%edi
ja     1188 <ascu+0x58>
mov    $0x1,%eax
lea    0xebb(%rip),%rcx
movslq (%rcx,%rdi,4),%rdi
add    %rcx,%rdi
jmp    *%rdi
mov    $0x2,%eax
jmp    1184 <ascu+0x54>
mov    $0x3,%eax
jmp    1184 <ascu+0x54>
mov    $0x4,%eax
jmp    1184 <ascu+0x54>
mov    $0x5,%eax
jmp    1184 <ascu+0x54>
mov    $0x6,%eax
jmp    1184 <ascu+0x54>
mov    $0x7,%eax
jmp    1184 <ascu+0x54>
mov    $0x8,%eax
jmp    1184 <ascu+0x54>
mov    $0x9,%eax
mov    %eax,(%rsi)
pop    %rax
ret
lea    0xf88(%rip),%rdi
jmp    11aa <ascu+0x7a>
mov    %rdx,%rdi
call   1040 <escreve_matriz@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xf5a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"\0A\0AJogo finalizado\0A\0A\00"
@.str.1 = [45 x i8] c"Caractere invalido. Nao sabe contar ate 9?\0A\0A\00"
define void @ascu(i8 signext %0, i32* %1, [9 x i32]* %2) {
%4 = alloca i8
%5 = alloca i32*
%6 = alloca [9 x i32]*
store i8 %0, i8* %4
store i32* %1, i32** %5
store [9 x i32]* %2, [9 x i32]** %6
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
switch i32 %8, label %35 [
i32 49, label %9
i32 50, label %11
i32 51, label %13
i32 52, label %15
i32 53, label %17
i32 54, label %19
i32 55, label %21
i32 56, label %23
i32 57, label %25
i32 113, label %27
i32 99, label %30
]
9: ; preds = %3
%10 = load i32*, i32** %5
store i32 1, i32* %10
br label %38
11: ; preds = %3
%12 = load i32*, i32** %5
store i32 2, i32* %12
br label %38
13: ; preds = %3
%14 = load i32*, i32** %5
store i32 3, i32* %14
br label %38
15: ; preds = %3
%16 = load i32*, i32** %5
store i32 4, i32* %16
br label %38
17: ; preds = %3
%18 = load i32*, i32** %5
store i32 5, i32* %18
br label %38
19: ; preds = %3
%20 = load i32*, i32** %5
store i32 6, i32* %20
br label %38
21: ; preds = %3
%22 = load i32*, i32** %5
store i32 7, i32* %22
br label %38
23: ; preds = %3
%24 = load i32*, i32** %5
store i32 8, i32* %24
br label %38
25: ; preds = %3
%26 = load i32*, i32** %5
store i32 9, i32* %26
br label %38
27: ; preds = %3
%28 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %3
%31 = load [9 x i32]*, [9 x i32]** %6
%32 = bitcast [9 x i32]* %31 to i32**
%33 = call i32 @escreve_matriz(i32** %32)
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %3
%36 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %25, %23, %21, %19, %17, %15, %13, %11, %9
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"\0A\0AJogo finalizado\0A\00"
@str.2 = [44 x i8] c"Caractere invalido. Nao sabe contar ate 9?\0A\00"
define void @ascu(i8 signext %0, i32* nocapture writeonly %1, [9 x i32]* %2) {
%4 = sext i8 %0 to i32
switch i32 %4, label %20 [
i32 49, label %23
i32 50, label %5
i32 51, label %6
i32 52, label %7
i32 53, label %8
i32 54, label %9
i32 55, label %10
i32 56, label %11
i32 57, label %12
i32 113, label %13
i32 99, label %16
]
5: ; preds = %3
br label %23
6: ; preds = %3
br label %23
7: ; preds = %3
br label %23
8: ; preds = %3
br label %23
9: ; preds = %3
br label %23
10: ; preds = %3
br label %23
11: ; preds = %3
br label %23
12: ; preds = %3
br label %23
13: ; preds = %3
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %3
%17 = bitcast [9 x i32]* %2 to i32**
%18 = tail call i32 @escreve_matriz(i32** %17)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %3
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.2, i64 0, i64 0))
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %3, %12, %11, %10, %9, %8, %7, %6, %5
%24 = phi i32 [ 9, %12 ], [ 8, %11 ], [ 7, %10 ], [ 6, %9 ], [ 5, %8 ], [ 4, %7 ], [ 3, %6 ], [ 2, %5 ], [ 1, %3 ]
store i32 %24, i32* %1
ret void
}