#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*/ printf(char *);
void hex_dump(short int input_buffer[]) {
  int i, digit, byte_space;
  byte_space = 1;
  for (i = 100; i >= 0; i -= 4) {
    digit = 0;
    digit += 1 * input_buffer[i];
    digit += 2 * input_buffer[i + 1];
    digit += 4 * input_buffer[i + 2];
    digit += 8 * input_buffer[i + 3];
    switch (digit) {
    case 0:
      printf("0");
      break;
    case 1:
      printf("1");
      break;
    case 2:
      printf("2");
      break;
    case 3:
      printf("3");
      break;
    case 4:
      printf("4");
      break;
    case 5:
      printf("5");
      break;
    case 6:
      printf("6");
      break;
    case 7:
      printf("7");
      break;
    case 8:
      printf("8");
      break;
    case 9:
      printf("9");
      break;
    case 10:
      printf("A");
      break;
    case 11:
      printf("B");
      break;
    case 12:
      printf("C");
      break;
    case 13:
      printf("D");
      break;
    case 14:
      printf("E");
      break;
    case 15:
      printf("F");
      break;
    }
    if (byte_space == 1) {
      byte_space = 0;
    } else {
      byte_space = 1;
      printf(" ");
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<hex_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x64,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1309 <hex_dump+0x1f9>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movswl (%rax,%rcx,2),%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movswl 0x2(%rax,%rcx,2),%edx
mov    -0x10(%rbp),%ecx
mov    %ecx,%eax
mov    %edx,%ecx
lea    (%rax,%rcx,2),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movswl 0x4(%rax,%rcx,2),%edx
mov    -0x10(%rbp),%ecx
mov    %ecx,%eax
mov    %edx,%ecx
lea    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movswl 0x6(%rax,%rcx,2),%edx
mov    -0x10(%rbp),%ecx
mov    %ecx,%eax
mov    %edx,%ecx
lea    (%rax,%rcx,8),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0xf,%rax
ja     12cd <hex_dump+0x1bd>
mov    -0x20(%rbp),%rax
lea    0xe47(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xdff(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xdf0(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xde1(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xdc3(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xdb4(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xda5(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <hex_dump+0x1bd>
lea    0xd96(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    12e3 <hex_dump+0x1d3>
movl   $0x0,-0x14(%rbp)
jmp    12f6 <hex_dump+0x1e6>
movl   $0x1,-0x14(%rbp)
lea    0xd6f(%rip),%rdi
call   1030 <printf@plt>
jmp    12fb <hex_dump+0x1eb>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <hex_dump+0x1a>
lea    0xd52(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_dump>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x1,%ebp
mov    $0xd0,%ebx
lea    0xed5(%rip),%r15
jmp    113f <hex_dump+0x2f>
nopl   (%rax)
xor    %eax,%eax
cmp    $0x1,%ebp
jne    1180 <hex_dump+0x70>
mov    %eax,%ebp
add    $0xfffffffffffffff8,%rbx
je     1191 <hex_dump+0x81>
movswq -0x8(%r14,%rbx,1),%rax
movswq -0x6(%r14,%rbx,1),%rcx
lea    (%rax,%rcx,2),%rax
movswq -0x4(%r14,%rbx,1),%rcx
lea    (%rax,%rcx,4),%rax
movswq -0x2(%r14,%rbx,1),%rcx
lea    (%rax,%rcx,8),%rax
cmp    $0xf,%eax
ja     1130 <hex_dump+0x20>
mov    (%r15,%rax,4),%edi
call   1030 <putchar@plt>
jmp    1130 <hex_dump+0x20>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x1,%eax
jmp    1137 <hex_dump+0x27>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@switch.table.hex_dump = [16 x i32] [i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 65, i32 66, i32 67, i32 68, i32 69, i32 70]
define void @hex_dump(i16* nocapture %0) {
br label %2
2: ; preds = %1, %36
%3 = phi i64 [ 100, %1 ], [ %38, %36 ]
%4 = phi i32 [ 1, %1 ], [ %37, %36 ]
%5 = getelementptr inbounds i16, i16* %0, i64 %3
%6 = load i16, i16* %5
%7 = sext i16 %6 to i32
%8 = or i64 %3, 1
%9 = getelementptr inbounds i16, i16* %0, i64 %8
%10 = load i16, i16* %9
%11 = sext i16 %10 to i32
%12 = shl nsw i32 %11, 1
%13 = add nsw i32 %12, %7
%14 = or i64 %3, 2
%15 = getelementptr inbounds i16, i16* %0, i64 %14
%16 = load i16, i16* %15
%17 = sext i16 %16 to i32
%18 = shl nsw i32 %17, 2
%19 = add nsw i32 %13, %18
%20 = or i64 %3, 3
%21 = getelementptr inbounds i16, i16* %0, i64 %20
%22 = load i16, i16* %21
%23 = sext i16 %22 to i32
%24 = shl nsw i32 %23, 3
%25 = add nsw i32 %19, %24
%26 = icmp ult i32 %25, 16
br i1 %26, label %27, label %32
27: ; preds = %2
%28 = sext i32 %25 to i64
%29 = getelementptr inbounds [16 x i32], [16 x i32]* @switch.table.hex_dump, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = tail call i32 @putchar(i32 %30)
br label %32
32: ; preds = %2, %27
%33 = icmp eq i32 %4, 1
br i1 %33, label %36, label %34
34: ; preds = %32
%35 = tail call i32 @putchar(i32 32)
br label %36
36: ; preds = %32, %34
%37 = phi i32 [ 1, %34 ], [ 0, %32 ]
%38 = add nsw i64 %3, -4
%39 = icmp eq i64 %3, 0
br i1 %39, label %40, label %2
40: ; preds = %36
%41 = tail call i32 @putchar(i32 10)
ret void
}