#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int i;
  int bit;
  uint32_t number;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <numberi1> <number2> ... <numberN>\n", argv[0]);
    return (1);
  };
  printf("%-10s   %10s   %12s   %-35s\n", "Hex", "Decimal", "Octal", "Binary");
  for (i = 1; i < argc; i++) {
    number = strtoul(argv[i], NULL, 0);
    printf("0x%08X   ", number);
    printf("%10lu   ", number);
    printf("%#12o   ", number);
    for (bit = 31; bit >= 0; bit--) {
      printf("%i", (int)((number >> bit) & (0x01)));
      if (bit == 0)
        printf("\n");
      else if ((bit % 8) == 0)
        printf(" ");
    };
  };
  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   $0x2,-0x8(%rbp)
jge    1178 <main+0x48>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe99(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    129d <main+0x16d>
lea    0xeaf(%rip),%rdi
lea    0xec5(%rip),%rsi
lea    0xec2(%rip),%rdx
lea    0xec3(%rip),%rcx
lea    0xec2(%rip),%r8
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1296 <main+0x166>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtoul@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1f,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1283 <main+0x153>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%ecx
sar    %cl,%esi
and    $0x1,%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1249 <main+0x119>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1270 <main+0x140>
mov    -0x18(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    126b <main+0x13b>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1270 <main+0x140>
jmp    1275 <main+0x145>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1209 <main+0xd9>
jmp    1288 <main+0x158>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a9 <main+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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
mov    %rsi,%r13
cmp    $0x1,%edi
jg     1176 <main+0x36>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xe99(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
jmp    1265 <main+0x125>
mov    %edi,%ebx
lea    0xeaf(%rip),%rdi
lea    0xec5(%rip),%rsi
lea    0xec2(%rip),%rdx
lea    0xec3(%rip),%rcx
lea    0xec2(%rip),%r8
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%r15d
mov    $0x1,%r12d
lea    0xece(%rip),%rbx
jmp    11d7 <main+0x97>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
cmp    %r15,%r12
je     1263 <main+0x123>
mov    0x0(%r13,%r12,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtoul@plt>
mov    %eax,%ebp
lea    0xe76(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe70(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe69(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%esi
shr    $0x1f,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1f,%r14d
jmp    1251 <main+0x111>
xchg   %ax,%ax
add    $0xffffffff,%r14d
mov    %ebp,%esi
mov    %r14d,%ecx
shr    %cl,%esi
and    $0x1,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
je     11c0 <main+0x80>
test   $0x7,%r14b
jne    1230 <main+0xf0>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1230 <main+0xf0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: %s <numberi1> <number2> ... <numberN>\0A\00"
@.str.1 = [29 x i8] c"%-10s %10s %12s %-35s\0A\00"
@.str.2 = [4 x i8] c"Hex\00"
@.str.3 = [8 x i8] c"Decimal\00"
@.str.4 = [6 x i8] c"Octal\00"
@.str.5 = [7 x i8] c"Binary\00"
@.str.6 = [10 x i8] c"0x%08X \00"
@.str.7 = [9 x i8] c"%10lu \00"
@.str.8 = [9 x i8] c"%o \00"
@.str.9 = [3 x i8] c"%i\00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [2 x i8] c" \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 slt i32 %9, 2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 1, i32* %3
br label %65
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %6
br label %19
19: ; preds = %61, %17
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %64
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @strtoul(i8* %28, i32* null, i32 0)
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %8
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %8
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 %34)
store i32 31, i32* %7
br label %36
36: ; preds = %57, %23
%37 = load i32, i32* %7
%38 = icmp sge i32 %37, 0
br i1 %38, label %39, label %60
39: ; preds = %36
%40 = load i32, i32* %8
%41 = load i32, i32* %7
%42 = ashr i32 %40, %41
%43 = and i32 %42, 1
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %7
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %39
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %56
49: ; preds = %39
%50 = load i32, i32* %7
%51 = srem i32 %50, 8
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %55
55: ; preds = %53, %49
br label %56
56: ; preds = %55, %47
br label %57
57: ; preds = %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, -1
store i32 %59, i32* %7
br label %36
60: ; preds = %36
br label %61
61: ; preds = %60
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
br label %19
64: ; preds = %19
store i32 0, i32* %3
br label %65
65: ; preds = %64, %11
%66 = load i32, i32* %3
ret i32 %66
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: %s <numberi1> <number2> ... <numberN>\0A\00"
@.str.1 = [29 x i8] c"%-10s %10s %12s %-35s\0A\00"
@.str.2 = [4 x i8] c"Hex\00"
@.str.3 = [8 x i8] c"Decimal\00"
@.str.4 = [6 x i8] c"Octal\00"
@.str.5 = [7 x i8] c"Binary\00"
@.str.6 = [10 x i8] c"0x%08X \00"
@.str.7 = [9 x i8] c"%10lu \00"
@.str.8 = [9 x i8] c"%o \00"
@.str.9 = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %37
8: ; preds = %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %8, %33
%12 = phi i64 [ 1, %8 ], [ %35, %33 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @strtoul(i8* nocapture %14, i32* null, i32 0)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %15)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 %15)
%19 = lshr i32 %15, 31
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %11, %27
%22 = phi i32 [ 31, %11 ], [ %28, %27 ]
%23 = and i32 %22, 7
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = tail call i32 @putchar(i32 32)
br label %27
27: ; preds = %25, %21
%28 = add nsw i32 %22, -1
%29 = lshr i32 %15, %28
%30 = and i32 %29, 1
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %30)
%32 = icmp eq i32 %28, 0
br i1 %32, label %33, label %21
33: ; preds = %27
%34 = tail call i32 @putchar(i32 10)
%35 = add nuw nsw i64 %12, 1
%36 = icmp eq i64 %35, %10
br i1 %36, label %37, label %11
37: ; preds = %33, %4
%38 = phi i32 [ 1, %4 ], [ 0, %33 ]
ret i32 %38
}