#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ isdigit(char const);
int /*<<< orphan*/ main_convertNumber(int, char const *);
int /*<<< orphan*/ main_convertQuint(char const *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char const **argv) {
  --argc;
  ++argv;
  for (; *argv; --argc, ++argv) {
    char const *s = *argv;
    if (!s[0])
      continue;
    if (s[0] == '0') {
      fprintf(stderr, "Do not lead input strings with a zero.\n"
                      "For decimal, trim leading zeros.\n"
                      "For hex, lead with an 'x'.\n"
                      "We do not process octal.\n");
      exit(1);
    } else if (s[0] == 'x' || s[0] == 'X') {
      main_convertNumber(16, s + 1);
    } else if (isdigit(s[0])) {
      main_convertNumber(10, s);
    } else {
      main_convertQuint(s);
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1277 <main+0x117>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11b6 <main+0x56>
jmp    125d <main+0xfd>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    11e5 <main+0x85>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
je     1205 <main+0xa5>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x58,%eax
jne    121c <main+0xbc>
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    $0x10,%edi
call   1030 <main_convertNumber@plt>
jmp    1253 <main+0xf3>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     1245 <main+0xe5>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1030 <main_convertNumber@plt>
jmp    124e <main+0xee>
mov    -0x18(%rbp),%rdi
call   1060 <main_convertQuint@plt>
jmp    1253 <main+0xf3>
jmp    1258 <main+0xf8>
jmp    125d <main+0xfd>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    118b <main+0x2b>
lea    0xdfd(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rbx
test   %rbx,%rbx
je     11d6 <main+0x76>
mov    %rsi,%r14
add    $0x10,%r14
jmp    119d <main+0x3d>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    $0x10,%edi
mov    %rbx,%rsi
call   1030 <main_convertNumber@plt>
mov    (%r14),%rbx
add    $0x8,%r14
test   %rbx,%rbx
je     11d6 <main+0x76>
movzbl (%rbx),%eax
cmp    $0x57,%al
jle    11b0 <main+0x50>
cmp    $0x58,%al
je     1180 <main+0x20>
cmp    $0x78,%al
je     1180 <main+0x20>
jmp    11b8 <main+0x58>
xchg   %ax,%ax
test   %al,%al
je     1191 <main+0x31>
cmp    $0x30,%al
je     11ea <main+0x8a>
movsbl %al,%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     11cc <main+0x6c>
mov    $0xa,%edi
jmp    1189 <main+0x29>
mov    %rbx,%rdi
call   1060 <main_convertQuint@plt>
jmp    1191 <main+0x31>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2def(%rip),%rax
mov    (%rax),%edi
lea    0xe06(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [125 x i8] c"Do not lead input strings with a zero.\0AFor decimal, trim leading zeros.\0AFor hex, lead with an 'x'.\0AWe do not process octal.\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = add nsw i32 %7, -1
store i32 %8, i32* %4
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i32 1
store i8** %10, i8*** %5
br label %11
11: ; preds = %64, %2
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %69
15: ; preds = %11
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = icmp ne i8 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %15
br label %64
23: ; preds = %15
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 48
br i1 %28, label %29, label %33
29: ; preds = %23
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %23
%34 = load i8*, i8** %6
%35 = getelementptr inbounds i8, i8* %34, i64 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 120
br i1 %38, label %45, label %39
39: ; preds = %33
%40 = load i8*, i8** %6
%41 = getelementptr inbounds i8, i8* %40, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 88
br i1 %44, label %45, label %49
45: ; preds = %39, %33
%46 = load i8*, i8** %6
%47 = getelementptr inbounds i8, i8* %46, i64 1
%48 = call i32 @main_convertNumber(i32 16, i8* %47)
br label %62
49: ; preds = %39
%50 = load i8*, i8** %6
%51 = getelementptr inbounds i8, i8* %50, i64 0
%52 = load i8, i8* %51
%53 = call i64 @isdigit(i8 signext %52)
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %49
%56 = load i8*, i8** %6
%57 = call i32 @main_convertNumber(i32 10, i8* %56)
br label %61
58: ; preds = %49
%59 = load i8*, i8** %6
%60 = call i32 @main_convertQuint(i8* %59)
br label %61
61: ; preds = %58, %55
br label %62
62: ; preds = %61, %45
br label %63
63: ; preds = %62
br label %64
64: ; preds = %63, %22
%65 = load i32, i32* %4
%66 = add nsw i32 %65, -1
store i32 %66, i32* %4
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i32 1
store i8** %68, i8*** %5
br label %11
69: ; preds = %11
%70 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [125 x i8] c"Do not lead input strings with a zero.\0AFor decimal, trim leading zeros.\0AFor hex, lead with an 'x'.\0AWe do not process octal.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %28, label %6
6: ; preds = %2, %24
%7 = phi i8* [ %26, %24 ], [ %4, %2 ]
%8 = phi i8** [ %25, %24 ], [ %3, %2 ]
%9 = load i8, i8* %7
switch i8 %9, label %17 [
i8 0, label %24
i8 48, label %10
i8 120, label %14
i8 88, label %14
]
10: ; preds = %6
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %6, %6
%15 = getelementptr inbounds i8, i8* %7, i64 1
%16 = tail call i32 @main_convertNumber(i32 16, i8* %15)
br label %24
17: ; preds = %6
%18 = tail call i64 @isdigit(i8 signext %9)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @main_convertNumber(i32 10, i8* %7)
br label %24
22: ; preds = %17
%23 = tail call i32 @main_convertQuint(i8* %7)
br label %24
24: ; preds = %20, %22, %14, %6
%25 = getelementptr inbounds i8*, i8** %8, i64 1
%26 = load i8*, i8** %25
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %6
28: ; preds = %24, %2
%29 = tail call i32 @putchar(i32 10)
ret i32 0
}