#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*/ sprintf(char *, char *, ...);
char *arg2str(unsigned char x, int one_digit) {
  static char buf[20];
  if (x <= 101)
    sprintf(buf, one_digit ? "%d" : "%02d", x);
  else if (x == 122)
    sprintf(buf, "|-");
  else if (x <= 127)
    sprintf(buf, "%c", "ABCDEFGHIJTZYXLMNOPQ.abcde"[x - 102]);
  else if (x <= 239)
    sprintf(buf, "IND %02d", x - 128);
  else if (x == 250)
    sprintf(buf, "IND |-");
  else
    sprintf(buf, "IND %c", "ABCDEFGHIJTZYXLMNOPQ.abcde"[x - 230]);
  return buf;
}


x86 assembly (clang, -O0):
<arg2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x65,%eax
jg     115d <arg2str+0x4d>
mov    -0x8(%rbp),%ecx
lea    0xeea(%rip),%rsi
lea    0xec1(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
movzbl -0x1(%rbp),%edx
lea    0x2eef(%rip),%rdi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    125c <arg2str+0x14c>
movzbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jne    1184 <arg2str+0x74>
lea    0x2ecf(%rip),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1257 <arg2str+0x147>
movzbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
jg     11c0 <arg2str+0xb0>
movzbl -0x1(%rbp),%eax
sub    $0x66,%eax
movslq %eax,%rcx
lea    0xe61(%rip),%rax
movsbl (%rax,%rcx,1),%edx
lea    0x2e93(%rip),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1252 <arg2str+0x142>
movzbl -0x1(%rbp),%eax
cmp    $0xef,%eax
jg     11f3 <arg2str+0xe3>
movzbl -0x1(%rbp),%edx
sub    $0x80,%edx
lea    0x2e60(%rip),%rdi
lea    0xe37(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    124d <arg2str+0x13d>
movzbl -0x1(%rbp),%eax
cmp    $0xfa,%eax
jne    121c <arg2str+0x10c>
lea    0x2e37(%rip),%rdi
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1248 <arg2str+0x138>
movzbl -0x1(%rbp),%eax
sub    $0xe6,%eax
movslq %eax,%rcx
lea    0xdd4(%rip),%rax
movsbl (%rax,%rcx,1),%edx
lea    0x2e06(%rip),%rdi
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    124d <arg2str+0x13d>
jmp    1252 <arg2str+0x142>
jmp    1257 <arg2str+0x147>
jmp    125c <arg2str+0x14c>
lea    0x2ddd(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg2str>:
push   %rax
mov    %edi,%edx
cmp    $0x65,%dl
ja     113c <arg2str+0x2c>
test   %esi,%esi
lea    0xf01(%rip),%rax
lea    0xed8(%rip),%rsi
cmove  %rax,%rsi
lea    0x2f0d(%rip),%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
jmp    1171 <arg2str+0x61>
cmp    $0x7a,%dl
jne    1153 <arg2str+0x43>
movb   $0x0,0x2efa(%rip)
movw   $0x2d7c,0x2eef(%rip)
7c 2d
jmp    1171 <arg2str+0x61>
test   %dl,%dl
js     117a <arg2str+0x6a>
add    $0xffffff9a,%edx
lea    0xea2(%rip),%rax
mov    (%rdx,%rax,1),%al
mov    %al,0x2ed6(%rip)
movb   $0x0,0x2ed0(%rip)
lea    0x2ec8(%rip),%rax
pop    %rcx
ret
cmp    $0xef,%dl
ja     1192 <arg2str+0x82>
add    $0xffffff80,%edx
lea    0x2eb7(%rip),%rdi
lea    0xe8e(%rip),%rsi
jmp    1133 <arg2str+0x23>
cmp    $0xfa,%dl
jne    11ad <arg2str+0x9d>
movl   $0x2d7c20,0x2ea2(%rip)
movl   $0x20444e49,0x2e95(%rip)
4e 44 20
jmp    1171 <arg2str+0x61>
add    $0xffffff1a,%edx
lea    0xe49(%rip),%rax
movsbl (%rdx,%rax,1),%edx
lea    0x2e7b(%rip),%rdi
lea    0xe62(%rip),%rsi
jmp    1133 <arg2str+0x23>

LLVM IR (-O0):
@arg2str.buf = internal global [20 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%02d\00"
@.str.2 = [3 x i8] c"|-\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [27 x i8] c"ABCDEFGHIJTZYXLMNOPQ.abcde\00"
@.str.5 = [9 x i8] c"IND %02d\00"
@.str.6 = [7 x i8] c"IND |-\00"
@.str.7 = [7 x i8] c"IND %c\00"
define i8* @arg2str(i8 zeroext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = icmp sle i32 %6, 101
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* %12, i32 %14)
br label %63
16: ; preds = %2
%17 = load i8, i8* %3
%18 = zext i8 %17 to i32
%19 = icmp eq i32 %18, 122
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %62
22: ; preds = %16
%23 = load i8, i8* %3
%24 = zext i8 %23 to i32
%25 = icmp sle i32 %24, 127
br i1 %25, label %26, label %35
26: ; preds = %22
%27 = load i8, i8* %3
%28 = zext i8 %27 to i32
%29 = sub nsw i32 %28, 102
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [27 x i8], [27 x i8]* @.str.4, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %33)
br label %61
35: ; preds = %22
%36 = load i8, i8* %3
%37 = zext i8 %36 to i32
%38 = icmp sle i32 %37, 239
br i1 %38, label %39, label %44
39: ; preds = %35
%40 = load i8, i8* %3
%41 = zext i8 %40 to i32
%42 = sub nsw i32 %41, 128
%43 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %42)
br label %60
44: ; preds = %35
%45 = load i8, i8* %3
%46 = zext i8 %45 to i32
%47 = icmp eq i32 %46, 250
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %59
50: ; preds = %44
%51 = load i8, i8* %3
%52 = zext i8 %51 to i32
%53 = sub nsw i32 %52, 230
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [27 x i8], [27 x i8]* @.str.4, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %50, %48
br label %60
60: ; preds = %59, %39
br label %61
61: ; preds = %60, %26
br label %62
62: ; preds = %61, %20
br label %63
63: ; preds = %62, %8
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@arg2str.buf = internal global [20 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%02d\00"
@.str.2 = [3 x i8] c"|-\00"
@.str.4 = [27 x i8] c"ABCDEFGHIJTZYXLMNOPQ.abcde\00"
@.str.5 = [9 x i8] c"IND %02d\00"
@.str.6 = [7 x i8] c"IND |-\00"
@.str.7 = [7 x i8] c"IND %c\00"
define i8* @arg2str(i8 zeroext %0, i32 %1) {
%3 = zext i8 %0 to i32
%4 = icmp ult i8 %0, 102
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = icmp eq i32 %1, 0
%7 = select i1 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%8 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* dereferenceable(1) %7, i32 %3)
br label %34
9: ; preds = %2
%10 = icmp eq i8 %0, 122
br i1 %10, label %11, label %12
11: ; preds = %9
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(3) getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 3, i1 false)
br label %34
12: ; preds = %9
%13 = icmp sgt i8 %0, -1
br i1 %13, label %14, label %19
14: ; preds = %12
%15 = add nsw i32 %3, -102
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds [27 x i8], [27 x i8]* @.str.4, i64 0, i64 %16
%18 = load i8, i8* %17
store i8 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 1)
br label %34
19: ; preds = %12
%20 = icmp ult i8 %0, -16
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = add nsw i32 %3, -128
%23 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %22)
br label %34
24: ; preds = %19
%25 = icmp eq i8 %0, -6
br i1 %25, label %26, label %27
26: ; preds = %24
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(7) getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i64 7, i1 false)
br label %34
27: ; preds = %24
%28 = add nsw i32 %3, -230
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [27 x i8], [27 x i8]* @.str.4, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %11, %21, %27, %26, %14, %5
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @arg2str.buf, i64 0, i64 0)
}