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


x86 assembly (clang, -O0):
<upc_e_to_a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f0d(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
movsbl 0x5(%rax),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffd0,%eax
sub    $0x3,%eax
jb     117d <upc_e_to_a+0x5d>
jmp    115b <upc_e_to_a+0x3b>
mov    -0xc(%rbp),%eax
sub    $0x33,%eax
je     11b8 <upc_e_to_a+0x98>
jmp    116c <upc_e_to_a+0x4c>
mov    -0xc(%rbp),%eax
sub    $0x34,%eax
je     11e6 <upc_e_to_a+0xc6>
jmp    1214 <upc_e_to_a+0xf4>
mov    -0x8(%rbp),%rsi
lea    0x2eb9(%rip),%rdi
mov    $0x2,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    0x5(%rax),%al
mov    %al,0x2ea4(%rip)
mov    -0x8(%rbp),%rsi
add    $0x2,%rsi
lea    0x2e9a(%rip),%rdi
mov    $0x3,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rsi
lea    0x2e7e(%rip),%rdi
mov    $0x3,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rsi
add    $0x3,%rsi
lea    0x2e6d(%rip),%rdi
mov    $0x2,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rsi
lea    0x2e50(%rip),%rdi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0x2e40(%rip),%rdi
mov    $0x1,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rsi
lea    0x2e22(%rip),%rdi
mov    $0x5,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rsi
add    $0x5,%rsi
lea    0x2e12(%rip),%rdi
mov    $0x1,%edx
call   1040 <memcpy@plt>
lea    0x2df7(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upc_e_to_a>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x2f12(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x5(%rbx),%r14
movsbl 0x5(%rbx),%eax
lea    -0x30(%rax),%ecx
cmp    $0x3,%ecx
jae    117e <upc_e_to_a+0x5e>
lea    0x2ef0(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
mov    0x5(%rbx),%al
mov    %al,0x2edc(%rip)
lea    0x2(%rbx),%rsi
lea    0x2ed6(%rip),%rdi
mov    $0x3,%edx
call   1040 <memcpy@plt>
jmp    118a <upc_e_to_a+0x6a>
cmp    $0x33,%eax
je     118a <upc_e_to_a+0x6a>
cmp    $0x34,%eax
je     11b3 <upc_e_to_a+0x93>
jmp    11dc <upc_e_to_a+0xbc>
lea    0x2eb0(%rip),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1040 <memcpy@plt>
lea    0x3(%rbx),%rsi
lea    0x2ea0(%rip),%rdi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    0x2e87(%rip),%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
lea    0x4(%rbx),%rsi
lea    0x2e78(%rip),%rdi
mov    $0x1,%edx
call   1040 <memcpy@plt>
lea    0x2e5e(%rip),%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <memcpy@plt>
lea    0x2e49(%rip),%rbx
lea    0x2e4c(%rip),%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@upc_e_to_a.result = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"00000000000\00"
define i8* @upc_e_to_a(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_a.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 = sext 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 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a.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_a.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_a.result, i64 0, i64 8), i8* %15, i32 3)
br label %17
17: ; preds = %1, %8
%18 = load i8*, i8** %2
%19 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a.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_a.result, i64 0, i64 9), i8* %21, i32 2)
br label %23
23: ; preds = %1, %17
%24 = load i8*, i8** %2
%25 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a.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_a.result, i64 0, i64 10), i8* %27, i32 1)
br label %29
29: ; preds = %1, %23
%30 = load i8*, i8** %2
%31 = call i32 @memcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a.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_a.result, i64 0, i64 10), i8* %33, i32 1)
br label %35
35: ; preds = %29
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @upc_e_to_a.result, i64 0, i64 0)
}

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