#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 */
char *calloc(int, int);
int /*<<< orphan*/ parser_Abort(char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *ConverteRegistrador(int num) {
  char *ret = calloc(4, sizeof(char));
  switch (num) {
  case 0:
    strcpy(ret, "000");
    break;
  case 1:
    strcpy(ret, "001");
    break;
  case 2:
    strcpy(ret, "010");
    break;
  case 3:
    strcpy(ret, "011");
    break;
  case 4:
    strcpy(ret, "100");
    break;
  case 5:
    strcpy(ret, "101");
    break;
  case 6:
    strcpy(ret, "110");
    break;
  case 7:
    strcpy(ret, "111");
    break;
  default:
    parser_Abort("Registrador invalido!");
  }
  ret[3] = '\0';
  return ret;
}


x86 assembly (clang, -O0):
<ConverteRegistrador>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x7,%rax
ja     121b <ConverteRegistrador+0xeb>
mov    -0x18(%rbp),%rax
lea    0xe96(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1227 <ConverteRegistrador+0xf7>
mov    -0x10(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1227 <ConverteRegistrador+0xf7>
mov    -0x10(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1227 <ConverteRegistrador+0xf7>
mov    -0x10(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1227 <ConverteRegistrador+0xf7>
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1227 <ConverteRegistrador+0xf7>
mov    -0x10(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1227 <ConverteRegistrador+0xf7>
mov    -0x10(%rbp),%rdi
lea    0xe3c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1227 <ConverteRegistrador+0xf7>
mov    -0x10(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1227 <ConverteRegistrador+0xf7>
lea    0xe1e(%rip),%rdi
call   1050 <parser_Abort@plt>
mov    -0x10(%rbp),%rax
movb   $0x0,0x3(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConverteRegistrador>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
cmp    $0x7,%ebp
ja     1167 <ConverteRegistrador+0x37>
mov    %ebp,%eax
lea    0xeab(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xebb(%rip),%rsi
jmp    11b2 <ConverteRegistrador+0x82>
lea    0xed2(%rip),%rdi
call   1050 <parser_Abort@plt>
jmp    11ba <ConverteRegistrador+0x8a>
lea    0xea8(%rip),%rsi
jmp    11b2 <ConverteRegistrador+0x82>
lea    0xea3(%rip),%rsi
jmp    11b2 <ConverteRegistrador+0x82>
lea    0xe9e(%rip),%rsi
jmp    11b2 <ConverteRegistrador+0x82>
lea    0xe99(%rip),%rsi
jmp    11b2 <ConverteRegistrador+0x82>
lea    0xe94(%rip),%rsi
jmp    11b2 <ConverteRegistrador+0x82>
lea    0xe8f(%rip),%rsi
jmp    11b2 <ConverteRegistrador+0x82>
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
movb   $0x0,0x3(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"000\00"
@.str.1 = [4 x i8] c"001\00"
@.str.2 = [4 x i8] c"010\00"
@.str.3 = [4 x i8] c"011\00"
@.str.4 = [4 x i8] c"100\00"
@.str.5 = [4 x i8] c"101\00"
@.str.6 = [4 x i8] c"110\00"
@.str.7 = [4 x i8] c"111\00"
@.str.8 = [22 x i8] c"Registrador invalido!\00"
define i8* @ConverteRegistrador(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i8* @calloc(i32 4, i32 1)
store i8* %4, i8** %3
%5 = load i32, i32* %2
switch i32 %5, label %30 [
i32 0, label %6
i32 1, label %9
i32 2, label %12
i32 3, label %15
i32 4, label %18
i32 5, label %21
i32 6, label %24
i32 7, label %27
]
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %32
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %32
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %32
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %32
18: ; preds = %1
%19 = load i8*, i8** %3
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %32
21: ; preds = %1
%22 = load i8*, i8** %3
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %32
24: ; preds = %1
%25 = load i8*, i8** %3
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %32
27: ; preds = %1
%28 = load i8*, i8** %3
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %32
30: ; preds = %1
%31 = call i32 @parser_Abort(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
br label %32
32: ; preds = %30, %27, %24, %21, %18, %15, %12, %9, %6
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i64 3
store i8 0, i8* %34
%35 = load i8*, i8** %3
ret i8* %35
}

LLVM IR (-O2):
@.str = [4 x i8] c"000\00"
@.str.1 = [4 x i8] c"001\00"
@.str.2 = [4 x i8] c"010\00"
@.str.3 = [4 x i8] c"011\00"
@.str.4 = [4 x i8] c"100\00"
@.str.5 = [4 x i8] c"101\00"
@.str.6 = [4 x i8] c"110\00"
@.str.7 = [4 x i8] c"111\00"
@.str.8 = [22 x i8] c"Registrador invalido!\00"
define i8* @ConverteRegistrador(i32 %0) {
%2 = tail call dereferenceable_or_null(4) i8* @calloc(i32 4, i32 1)
switch i32 %0, label %19 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
i32 3, label %9
i32 4, label %11
i32 5, label %13
i32 6, label %15
i32 7, label %17
]
3: ; preds = %1
%4 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %21
5: ; preds = %1
%6 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %21
7: ; preds = %1
%8 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %21
9: ; preds = %1
%10 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %21
11: ; preds = %1
%12 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %21
13: ; preds = %1
%14 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %21
15: ; preds = %1
%16 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %21
17: ; preds = %1
%18 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %21
19: ; preds = %1
%20 = tail call i32 @parser_Abort(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
br label %21
21: ; preds = %19, %17, %15, %13, %11, %9, %7, %5, %3
%22 = getelementptr inbounds i8, i8* %2, i64 3
store i8 0, i8* %22
ret i8* %2
}