#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*/ memcpy(char *, unsigned char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, unsigned char *, int);
char *upc_e_to_a0(unsigned char *text) {
  static char result[16];
  strcpy(result, "00000000000");
  switch (text[5]) {
  case '0':
  case '1':
  case '2':
    strncpy(result + 1, text, 2);
    result[3] = text[5];
    memcpy(result + 8, text + 2, 3);
    break;
  case '3':
    memcpy(result + 1, text, 3);
    memcpy(result + 9, text + 3, 2);
    break;
  case '4':
    memcpy(result + 1, text, 4);
    memcpy(result + 10, text + 4, 1);
    break;
  default:
    memcpy(result + 1, text, 5);
    memcpy(result + 10, text + 5, 1);
    break;
  }
  return result;
}


x86 assembly (clang, -O0):
<upc_e_to_a0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f0d(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x8(%rbp),%rax
movzbl 0x5(%rax),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffd0,%eax
sub    $0x3,%eax
jb     118d <upc_e_to_a0+0x5d>
jmp    116b <upc_e_to_a0+0x3b>
mov    -0xc(%rbp),%eax
sub    $0x33,%eax
je     11d1 <upc_e_to_a0+0xa1>
jmp    117c <upc_e_to_a0+0x4c>
mov    -0xc(%rbp),%eax
sub    $0x34,%eax
je     1204 <upc_e_to_a0+0xd4>
jmp    1237 <upc_e_to_a0+0x107>
mov    -0x8(%rbp),%rsi
lea    0x2eb8(%rip),%rdi
add    $0x1,%rdi
mov    $0x2,%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
mov    0x5(%rax),%al
mov    %al,0x2ea0(%rip)
mov    -0x8(%rbp),%rsi
add    $0x2,%rsi
lea    0x2e96(%rip),%rdi
mov    $0x3,%edx
call   1050 <memcpy@plt>
jmp    1265 <upc_e_to_a0+0x135>
mov    -0x8(%rbp),%rsi
lea    0x2e75(%rip),%rdi
mov    $0x3,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rsi
add    $0x3,%rsi
lea    0x2e64(%rip),%rdi
mov    $0x2,%edx
call   1050 <memcpy@plt>
jmp    1265 <upc_e_to_a0+0x135>
mov    -0x8(%rbp),%rsi
lea    0x2e42(%rip),%rdi
mov    $0x4,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0x2e32(%rip),%rdi
mov    $0x1,%edx
call   1050 <memcpy@plt>
jmp    1265 <upc_e_to_a0+0x135>
mov    -0x8(%rbp),%rsi
lea    0x2e0f(%rip),%rdi
mov    $0x5,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rsi
add    $0x5,%rsi
lea    0x2dff(%rip),%rdi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0x2de4(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upc_e_to_a0>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x2f12(%rip),%rdi
lea    0xebb(%rip),%rsi
call   1040 <strcpy@plt>
mov    0x5(%rbx),%al
lea    -0x30(%rax),%ecx
cmp    $0x3,%cl
jae    1187 <upc_e_to_a0+0x57>
lea    0x2ef5(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
mov    0x5(%rbx),%al
mov    %al,0x2ee1(%rip)
add    $0x2,%rbx
lea    0x2edb(%rip),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
jmp    1203 <upc_e_to_a0+0xd3>
cmp    $0x33,%al
je     11b3 <upc_e_to_a0+0x83>
cmp    $0x34,%al
jne    11dc <upc_e_to_a0+0xac>
lea    0x2ebb(%rip),%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1050 <memcpy@plt>
add    $0x4,%rbx
lea    0x2eac(%rip),%rdi
mov    %rbx,%rsi
jmp    11fe <upc_e_to_a0+0xce>
lea    0x2e97(%rip),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1050 <memcpy@plt>
add    $0x3,%rbx
lea    0x2e87(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
jmp    1203 <upc_e_to_a0+0xd3>
lea    0x5(%rbx),%r14
lea    0x2e6a(%rip),%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1050 <memcpy@plt>
lea    0x2e5f(%rip),%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0x2e41(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@upc_e_to_a0.result = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"00000000000\00"
define i8* @upc_e_to_a0(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @strcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 5
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
switch i32 %7, label %29 [
i32 48, label %8
i32 49, label %8
i32 50, label %8
i32 51, label %17
i32 52, label %23
]
8: ; preds = %1, %1, %1
%9 = load i8*, i8** %2
%10 = call i32 @strncpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 1), i8* %9, i32 2)
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 5
%13 = load i8, i8* %12
store i8 %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 3)
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 8), i8* %15, i32 3)
br label %35
17: ; preds = %1
%18 = load i8*, i8** %2
%19 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 1), i8* %18, i32 3)
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 3
%22 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 9), i8* %21, i32 2)
br label %35
23: ; preds = %1
%24 = load i8*, i8** %2
%25 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 1), i8* %24, i32 4)
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 4
%28 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 10), i8* %27, i32 1)
br label %35
29: ; preds = %1
%30 = load i8*, i8** %2
%31 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 1), i8* %30, i32 5)
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i64 5
%34 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 10), i8* %33, i32 1)
br label %35
35: ; preds = %29, %23, %17, %8
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 0)
}

LLVM IR (-O2):
@upc_e_to_a0.result = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"00000000000\00"
define i8* @upc_e_to_a0(i8* %0) {
%2 = tail call i32 @strcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds i8, i8* %0, i64 5
%4 = load i8, i8* %3
switch i8 %4, label %18 [
i8 48, label %5
i8 49, label %5
i8 50, label %5
i8 51, label %10
i8 52, label %14
]
5: ; preds = %1, %1, %1
%6 = tail call i32 @strncpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 1), i8* %0, i32 2)
%7 = load i8, i8* %3
store i8 %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 3)
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = tail call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 8), i8* %8, i32 3)
br label %21
10: ; preds = %1
%11 = tail call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 1), i8* %0, i32 3)
%12 = getelementptr inbounds i8, i8* %0, i64 3
%13 = tail call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 9), i8* %12, i32 2)
br label %21
14: ; preds = %1
%15 = tail call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 1), i8* %0, i32 4)
%16 = getelementptr inbounds i8, i8* %0, i64 4
%17 = tail call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 10), i8* %16, i32 1)
br label %21
18: ; preds = %1
%19 = tail call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 1), i8* %0, i32 5)
%20 = tail call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 10), i8* %3, i32 1)
br label %21
21: ; preds = %18, %14, %10, %5
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a0.result, i64 0, i64 0)
}