#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*/ dispall();
int /*<<< orphan*/ dispcode(unsigned int);
int /*<<< orphan*/ dispversion();
int /*<<< orphan*/ printf(char *, char *);
int sscanf(char *, char *, unsigned int *);
int main(int argc, char *argv[]) {
  if (argc == 1)
    dispall();
  else if (argv[1][0] == '-')
    dispversion();
  else {
    int i, rtn;
    unsigned int charnum;
    for (i = 1; i < argc; i++) {
      if (argv[i][0] == '0' && (argv[i][1] == 'x' || argv[i][1] == 'X')) {
        rtn = sscanf(argv[i], "%x", &charnum);
      } else {
        rtn = sscanf(argv[i], "%ud", &charnum);
      }
      if (rtn == 1)
        dispcode(charnum);
      else
        printf("Skipping unrecognized arg (%s)\n", argv[i]);
    }
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jne    117c <main+0x2c>
mov    $0x0,%al
call   1070 <dispall@plt>
jmp    1288 <main+0x138>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    119c <main+0x4c>
mov    $0x0,%al
call   1060 <dispversion@plt>
jmp    1283 <main+0x133>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    127e <main+0x12e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    121d <main+0xcd>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
je     11f9 <main+0xa9>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
cmp    $0x58,%eax
jne    121d <main+0xcd>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdf4(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x18(%rbp)
jmp    123c <main+0xec>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdd3(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1253 <main+0x103>
mov    -0x1c(%rbp),%edi
call   1040 <dispcode@plt>
jmp    126b <main+0x11b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xda1(%rip),%rdi
call   1030 <printf@plt>
jmp    1270 <main+0x120>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a3 <main+0x53>
jmp    1283 <main+0x133>
jmp    1288 <main+0x138>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    116c <main+0x1c>
xor    %eax,%eax
call   1070 <dispall@plt>
jmp    1210 <main+0xc0>
mov    %rsi,%r13
mov    %edi,%eax
mov    0x8(%rsi),%rdi
mov    (%rdi),%cl
cmp    $0x2d,%cl
jne    1188 <main+0x38>
xor    %eax,%eax
call   1060 <dispversion@plt>
jmp    1210 <main+0xc0>
cmp    $0x2,%eax
jl     1210 <main+0xc0>
mov    %eax,%r12d
mov    $0x2,%ebx
lea    0xe63(%rip),%rbp
lea    0x4(%rsp),%r14
lea    0xe5b(%rip),%r15
nopl   0x0(%rax)
mov    %rbp,%rsi
cmp    $0x30,%cl
jne    11cc <main+0x7c>
movzbl 0x1(%rdi),%eax
and    $0xdf,%al
lea    0xe3b(%rip),%rsi
cmp    $0x58,%al
je     11cc <main+0x7c>
mov    %rbp,%rsi
mov    %r14,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11f0 <main+0xa0>
mov    0x4(%rsp),%edi
call   1040 <dispcode@plt>
cmp    %rbx,%r12
jne    1202 <main+0xb2>
jmp    1210 <main+0xc0>
nopl   0x0(%rax)
mov    -0x8(%r13,%rbx,8),%rsi
mov    %r15,%rdi
call   1030 <printf@plt>
cmp    %rbx,%r12
je     1210 <main+0xc0>
mov    0x0(%r13,%rbx,8),%rdi
movzbl (%rdi),%ecx
add    $0x1,%rbx
jmp    11b0 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%x\00"
@.str.1 = [4 x i8] c"%ud\00"
@.str.2 = [32 x i8] c"Skipping unrecognized arg (%s)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @dispall()
br label %91
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 45
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = call i32 (...) @dispversion()
br label %90
23: ; preds = %13
store i32 1, i32* %6
br label %24
24: ; preds = %86, %23
%25 = load i32, i32* %6
%26 = load i32, i32* %4
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %89
28: ; preds = %24
%29 = load i8**, i8*** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8, i8* %33, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 48
br i1 %37, label %38, label %65
38: ; preds = %28
%39 = load i8**, i8*** %5
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = getelementptr inbounds i8, i8* %43, i64 1
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 120
br i1 %47, label %58, label %48
48: ; preds = %38
%49 = load i8**, i8*** %5
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = getelementptr inbounds i8, i8* %53, i64 1
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 88
br i1 %57, label %58, label %65
58: ; preds = %48, %38
%59 = load i8**, i8*** %5
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = call i32 @sscanf(i8* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
store i32 %64, i32* %7
br label %72
65: ; preds = %48, %28
%66 = load i8**, i8*** %5
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i32 @sscanf(i8* %70, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %8)
store i32 %71, i32* %7
br label %72
72: ; preds = %65, %58
%73 = load i32, i32* %7
%74 = icmp eq i32 %73, 1
br i1 %74, label %75, label %78
75: ; preds = %72
%76 = load i32, i32* %8
%77 = call i32 @dispcode(i32 %76)
br label %85
78: ; preds = %72
%79 = load i8**, i8*** %5
%80 = load i32, i32* %6
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8*, i8** %79, i64 %81
%83 = load i8*, i8** %82
%84 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %83)
br label %85
85: ; preds = %78, %75
br label %86
86: ; preds = %85
%87 = load i32, i32* %6
%88 = add nsw i32 %87, 1
store i32 %88, i32* %6
br label %24
89: ; preds = %24
br label %90
90: ; preds = %89, %21
br label %91
91: ; preds = %90, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
@.str.1 = [4 x i8] c"%ud\00"
@.str.2 = [32 x i8] c"Skipping unrecognized arg (%s)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @dispall()
br label %49
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 45
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 (...) @dispversion()
br label %49
14: ; preds = %7
%15 = bitcast i32* %3 to i8*
%16 = icmp sgt i32 %0, 1
br i1 %16, label %17, label %48
17: ; preds = %14
%18 = zext i32 %0 to i64
br label %19
19: ; preds = %44, %17
%20 = phi i8 [ %10, %17 ], [ %47, %44 ]
%21 = phi i8* [ %9, %17 ], [ %46, %44 ]
%22 = phi i64 [ 1, %17 ], [ %42, %44 ]
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = icmp eq i8 %20, 48
br i1 %24, label %25, label %31
25: ; preds = %19
%26 = getelementptr inbounds i8, i8* %21, i64 1
%27 = load i8, i8* %26
%28 = and i8 %27, -33
%29 = icmp eq i8 %28, 88
%30 = select i1 %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
br label %31
31: ; preds = %19, %25
%32 = phi i8* [ %30, %25 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %19 ]
%33 = call i32 @sscanf(i8* %21, i8* %32, i32* %3)
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* %3
%37 = call i32 @dispcode(i32 %36)
br label %41
38: ; preds = %31
%39 = load i8*, i8** %23
%40 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %35, %38
%42 = add nuw nsw i64 %22, 1
%43 = icmp eq i64 %42, %18
br i1 %43, label %48, label %44
44: ; preds = %41
%45 = getelementptr inbounds i8*, i8** %1, i64 %42
%46 = load i8*, i8** %45
%47 = load i8, i8* %46
br label %19
48: ; preds = %41, %14
br label %49
49: ; preds = %12, %48, %5
ret i32 0
}