#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*/ strncat(char *, char *, int);
int agrega_las_unidades(const unsigned int numero, char *buffer) {
  int len = 0;
  if (numero == 0) {
    len = 4;
    strncat(buffer, "cero", len);
  } else if (numero == 1) {
    len = 2;
    strncat(buffer, "un", len);
  } else if (numero == 2) {
    len = 3;
    strncat(buffer, "dos", len);
  } else if (numero == 3) {
    len = 4;
    strncat(buffer, "tres", len);
  } else if (numero == 4) {
    len = 6;
    strncat(buffer, "cuatro", len);
  } else if (numero == 5) {
    len = 5;
    strncat(buffer, "cinco", len);
  } else if (numero == 6) {
    len = 4;
    strncat(buffer, "seis", len);
  } else if (numero == 7) {
    len = 5;
    strncat(buffer, "siete", len);
  } else if (numero == 8) {
    len = 4;
    strncat(buffer, "ocho", len);
  } else if (numero == 9) {
    len = 5;
    strncat(buffer, "nueve", len);
  }
  return len;
}


x86 assembly (clang, -O0):
<agrega_las_unidades>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114f <agrega_las_unidades+0x3f>
movl   $0x4,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xebb(%rip),%rsi
call   1030 <strncat@plt>
jmp    12e8 <agrega_las_unidades+0x1d8>
cmpl   $0x1,-0x4(%rbp)
jne    1178 <agrega_las_unidades+0x68>
movl   $0x2,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe97(%rip),%rsi
call   1030 <strncat@plt>
jmp    12e3 <agrega_las_unidades+0x1d3>
cmpl   $0x2,-0x4(%rbp)
jne    11a1 <agrega_las_unidades+0x91>
movl   $0x3,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe71(%rip),%rsi
call   1030 <strncat@plt>
jmp    12de <agrega_las_unidades+0x1ce>
cmpl   $0x3,-0x4(%rbp)
jne    11ca <agrega_las_unidades+0xba>
movl   $0x4,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe4c(%rip),%rsi
call   1030 <strncat@plt>
jmp    12d9 <agrega_las_unidades+0x1c9>
cmpl   $0x4,-0x4(%rbp)
jne    11f3 <agrega_las_unidades+0xe3>
movl   $0x6,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe28(%rip),%rsi
call   1030 <strncat@plt>
jmp    12d4 <agrega_las_unidades+0x1c4>
cmpl   $0x5,-0x4(%rbp)
jne    121c <agrega_las_unidades+0x10c>
movl   $0x5,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe06(%rip),%rsi
call   1030 <strncat@plt>
jmp    12cf <agrega_las_unidades+0x1bf>
cmpl   $0x6,-0x4(%rbp)
jne    1245 <agrega_las_unidades+0x135>
movl   $0x4,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xde3(%rip),%rsi
call   1030 <strncat@plt>
jmp    12ca <agrega_las_unidades+0x1ba>
cmpl   $0x7,-0x4(%rbp)
jne    126e <agrega_las_unidades+0x15e>
movl   $0x5,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xdbf(%rip),%rsi
call   1030 <strncat@plt>
jmp    12c5 <agrega_las_unidades+0x1b5>
cmpl   $0x8,-0x4(%rbp)
jne    1297 <agrega_las_unidades+0x187>
movl   $0x4,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd9c(%rip),%rsi
call   1030 <strncat@plt>
jmp    12c0 <agrega_las_unidades+0x1b0>
cmpl   $0x9,-0x4(%rbp)
jne    12bb <agrega_las_unidades+0x1ab>
movl   $0x5,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd78(%rip),%rsi
call   1030 <strncat@plt>
jmp    12c0 <agrega_las_unidades+0x1b0>
jmp    12c5 <agrega_las_unidades+0x1b5>
jmp    12ca <agrega_las_unidades+0x1ba>
jmp    12cf <agrega_las_unidades+0x1bf>
jmp    12d4 <agrega_las_unidades+0x1c4>
jmp    12d9 <agrega_las_unidades+0x1c9>
jmp    12de <agrega_las_unidades+0x1ce>
jmp    12e3 <agrega_las_unidades+0x1d3>
jmp    12e8 <agrega_las_unidades+0x1d8>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<agrega_las_unidades>:
push   %rbx
cmp    $0x9,%edi
ja     1134 <agrega_las_unidades+0x24>
mov    %edi,%eax
lea    0xee1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xef9(%rip),%rax
jmp    11cd <agrega_las_unidades+0xbd>
xor    %ebx,%ebx
jmp    11e2 <agrega_las_unidades+0xd2>
lea    0xeeb(%rip),%rax
mov    $0x2,%ebx
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x2,%edx
jmp    11dd <agrega_las_unidades+0xcd>
lea    0xed2(%rip),%rax
mov    $0x3,%ebx
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x3,%edx
jmp    11dd <agrega_las_unidades+0xcd>
lea    0xebd(%rip),%rax
jmp    11cd <agrega_las_unidades+0xbd>
lea    0xeb9(%rip),%rax
mov    $0x6,%ebx
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x6,%edx
jmp    11dd <agrega_las_unidades+0xcd>
lea    0xea7(%rip),%rax
jmp    11b4 <agrega_las_unidades+0xa4>
lea    0xea4(%rip),%rax
jmp    11cd <agrega_las_unidades+0xbd>
lea    0xea0(%rip),%rax
jmp    11b4 <agrega_las_unidades+0xa4>
lea    0xea2(%rip),%rax
mov    $0x5,%ebx
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x5,%edx
jmp    11dd <agrega_las_unidades+0xcd>
lea    0xe84(%rip),%rax
mov    $0x4,%ebx
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x4,%edx
call   1030 <strncat@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"cero\00"
@.str.1 = [3 x i8] c"un\00"
@.str.2 = [4 x i8] c"dos\00"
@.str.3 = [5 x i8] c"tres\00"
@.str.4 = [7 x i8] c"cuatro\00"
@.str.5 = [6 x i8] c"cinco\00"
@.str.6 = [5 x i8] c"seis\00"
@.str.7 = [6 x i8] c"siete\00"
@.str.8 = [5 x i8] c"ocho\00"
@.str.9 = [6 x i8] c"nueve\00"
define i32 @agrega_las_unidades(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
store i32 4, i32* %5
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %84
12: ; preds = %2
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %19
15: ; preds = %12
store i32 2, i32* %5
%16 = load i8*, i8** %4
%17 = load i32, i32* %5
%18 = call i32 @strncat(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %83
19: ; preds = %12
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %26
22: ; preds = %19
store i32 3, i32* %5
%23 = load i8*, i8** %4
%24 = load i32, i32* %5
%25 = call i32 @strncat(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %82
26: ; preds = %19
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 3
br i1 %28, label %29, label %33
29: ; preds = %26
store i32 4, i32* %5
%30 = load i8*, i8** %4
%31 = load i32, i32* %5
%32 = call i32 @strncat(i8* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %81
33: ; preds = %26
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 4
br i1 %35, label %36, label %40
36: ; preds = %33
store i32 6, i32* %5
%37 = load i8*, i8** %4
%38 = load i32, i32* %5
%39 = call i32 @strncat(i8* %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %38)
br label %80
40: ; preds = %33
%41 = load i32, i32* %3
%42 = icmp eq i32 %41, 5
br i1 %42, label %43, label %47
43: ; preds = %40
store i32 5, i32* %5
%44 = load i8*, i8** %4
%45 = load i32, i32* %5
%46 = call i32 @strncat(i8* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %45)
br label %79
47: ; preds = %40
%48 = load i32, i32* %3
%49 = icmp eq i32 %48, 6
br i1 %49, label %50, label %54
50: ; preds = %47
store i32 4, i32* %5
%51 = load i8*, i8** %4
%52 = load i32, i32* %5
%53 = call i32 @strncat(i8* %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %52)
br label %78
54: ; preds = %47
%55 = load i32, i32* %3
%56 = icmp eq i32 %55, 7
br i1 %56, label %57, label %61
57: ; preds = %54
store i32 5, i32* %5
%58 = load i8*, i8** %4
%59 = load i32, i32* %5
%60 = call i32 @strncat(i8* %58, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %59)
br label %77
61: ; preds = %54
%62 = load i32, i32* %3
%63 = icmp eq i32 %62, 8
br i1 %63, label %64, label %68
64: ; preds = %61
store i32 4, i32* %5
%65 = load i8*, i8** %4
%66 = load i32, i32* %5
%67 = call i32 @strncat(i8* %65, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %66)
br label %76
68: ; preds = %61
%69 = load i32, i32* %3
%70 = icmp eq i32 %69, 9
br i1 %70, label %71, label %75
71: ; preds = %68
store i32 5, i32* %5
%72 = load i8*, i8** %4
%73 = load i32, i32* %5
%74 = call i32 @strncat(i8* %72, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 %73)
br label %75
75: ; preds = %71, %68
br label %76
76: ; preds = %75, %64
br label %77
77: ; preds = %76, %57
br label %78
78: ; preds = %77, %50
br label %79
79: ; preds = %78, %43
br label %80
80: ; preds = %79, %36
br label %81
81: ; preds = %80, %29
br label %82
82: ; preds = %81, %22
br label %83
83: ; preds = %82, %15
br label %84
84: ; preds = %83, %8
%85 = load i32, i32* %5
ret i32 %85
}

LLVM IR (-O2):
@.str = [5 x i8] c"cero\00"
@.str.1 = [3 x i8] c"un\00"
@.str.2 = [4 x i8] c"dos\00"
@.str.3 = [5 x i8] c"tres\00"
@.str.4 = [7 x i8] c"cuatro\00"
@.str.5 = [6 x i8] c"cinco\00"
@.str.6 = [5 x i8] c"seis\00"
@.str.7 = [6 x i8] c"siete\00"
@.str.8 = [5 x i8] c"ocho\00"
@.str.9 = [6 x i8] c"nueve\00"
define i32 @agrega_las_unidades(i32 %0, i8* %1) {
switch i32 %0, label %23 [
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
i32 8, label %19
i32 9, label %21
]
3: ; preds = %2
%4 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
br label %23
5: ; preds = %2
%6 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %23
7: ; preds = %2
%8 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
br label %23
9: ; preds = %2
%10 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
br label %23
11: ; preds = %2
%12 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 6)
br label %23
13: ; preds = %2
%14 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 5)
br label %23
15: ; preds = %2
%16 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
br label %23
17: ; preds = %2
%18 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
br label %23
19: ; preds = %2
%20 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
br label %23
21: ; preds = %2
%22 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
br label %23
23: ; preds = %2, %5, %9, %13, %17, %21, %19, %15, %11, %7, %3
%24 = phi i32 [ 4, %3 ], [ 2, %5 ], [ 3, %7 ], [ 4, %9 ], [ 6, %11 ], [ 5, %13 ], [ 4, %15 ], [ 5, %17 ], [ 4, %19 ], [ 5, %21 ], [ 0, %2 ]
ret i32 %24
}