#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 *, int);
int /*<<< orphan*/ puts(char *);
void show_bytecode(const unsigned char *bytecode, size_t bytecode_size) {
  size_t i, j;
  size_t quot = bytecode_size / 16;
  size_t rem = bytecode_size % 16;
  int addr_cnt = 0;
  puts("ADDRESS  00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f");
  for (i = 0; i < quot; i++) {
    printf("0x%04x: ", addr_cnt);
    addr_cnt += 16;
    for (j = 0; j < 16; j++) {
      printf(" %02x", *bytecode++);
    }
    puts("");
  }
  printf("0x%04x: ", addr_cnt);
  for (i = 0; i < rem; i++) {
    printf(" %02x", *bytecode++);
  }
  puts("");
}


x86 assembly (clang, -O0):
<show_bytecode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
and    $0xf,%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11e8 <show_bytecode+0xc8>
mov    -0x34(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x34(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x10,-0x20(%rbp)
jae    11cb <show_bytecode+0xab>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%esi
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1191 <show_bytecode+0x71>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1163 <show_bytecode+0x43>
mov    -0x34(%rbp),%esi
lea    0xe47(%rip),%rdi
call   1040 <printf@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    123c <show_bytecode+0x11c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%esi
lea    0xe1c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11ff <show_bytecode+0xdf>
lea    0xdfe(%rip),%rdi
call   1030 <puts@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_bytecode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %r15d,%r12d
and    $0xf,%r12d
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
cmp    $0x10,%r15
jb     1284 <show_bytecode+0x154>
shr    $0x4,%r15
xor    %ebx,%ebx
lea    0xecc(%rip),%rbp
lea    0xece(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
movzbl (%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0x1(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0x2(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0x3(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0x4(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0x5(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0x6(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0x7(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0x8(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0x9(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0xa(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0xb(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0xc(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0xd(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0xe(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
movzbl 0xf(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rbx
add    $0xffffffffffffffff,%r15
jne    1180 <show_bytecode+0x50>
add    %rbx,%r14
lea    0xdae(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
test   %r12,%r12
je     12b6 <show_bytecode+0x186>
xor    %ebp,%ebp
lea    0xda2(%rip),%rbx
movzbl (%r14,%rbp,1),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    12a0 <show_bytecode+0x170>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [57 x i8] c"ADDRESS 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\00"
@.str.1 = [9 x i8] c"0x%04x: \00"
@.str.2 = [6 x i8] c" %02x\00"
@.str.3 = [1 x i8] zeroinitializer
define void @show_bytecode(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%10 = load i64, i64* %4
%11 = udiv i64 %10, 16
store i64 %11, i64* %7
%12 = load i64, i64* %4
%13 = urem i64 %12, 16
store i64 %13, i64* %8
store i32 0, i32* %9
%14 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %5
br label %15
15: ; preds = %38, %2
%16 = load i64, i64* %5
%17 = load i64, i64* %7
%18 = icmp ult i64 %16, %17
br i1 %18, label %19, label %41
19: ; preds = %15
%20 = load i32, i32* %9
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %9
%23 = add nsw i32 %22, 16
store i32 %23, i32* %9
store i64 0, i64* %6
br label %24
24: ; preds = %33, %19
%25 = load i64, i64* %6
%26 = icmp ult i64 %25, 16
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %3
%30 = load i8, i8* %28
%31 = zext i8 %30 to i32
%32 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %27
%34 = load i64, i64* %6
%35 = add i64 %34, 1
store i64 %35, i64* %6
br label %24
36: ; preds = %24
%37 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i64, i64* %5
%40 = add i64 %39, 1
store i64 %40, i64* %5
br label %15
41: ; preds = %15
%42 = load i32, i32* %9
%43 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %42)
store i64 0, i64* %5
br label %44
44: ; preds = %54, %41
%45 = load i64, i64* %5
%46 = load i64, i64* %8
%47 = icmp ult i64 %45, %46
br i1 %47, label %48, label %57
48: ; preds = %44
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %3
%51 = load i8, i8* %49
%52 = zext i8 %51 to i32
%53 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %48
%55 = load i64, i64* %5
%56 = add i64 %55, 1
store i64 %56, i64* %5
br label %44
57: ; preds = %44
%58 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [57 x i8] c"ADDRESS 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\00"
@.str.1 = [9 x i8] c"0x%04x: \00"
@.str.2 = [6 x i8] c" %02x\00"
define void @show_bytecode(i8* nocapture %0, i64 %1) {
%3 = and i64 %1, 15
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%5 = icmp ult i64 %1, 16
br i1 %5, label %81, label %6
6: ; preds = %2
%7 = lshr i64 %1, 4
br label %8
8: ; preds = %6, %8
%9 = phi i32 [ %77, %8 ], [ 0, %6 ]
%10 = phi i8* [ %73, %8 ], [ %0, %6 ]
%11 = phi i64 [ %79, %8 ], [ 0, %6 ]
%12 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = load i8, i8* %10
%15 = zext i8 %14 to i32
%16 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds i8, i8* %10, i64 2
%18 = load i8, i8* %13
%19 = zext i8 %18 to i32
%20 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds i8, i8* %10, i64 3
%22 = load i8, i8* %17
%23 = zext i8 %22 to i32
%24 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds i8, i8* %10, i64 4
%26 = load i8, i8* %21
%27 = zext i8 %26 to i32
%28 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds i8, i8* %10, i64 5
%30 = load i8, i8* %25
%31 = zext i8 %30 to i32
%32 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds i8, i8* %10, i64 6
%34 = load i8, i8* %29
%35 = zext i8 %34 to i32
%36 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds i8, i8* %10, i64 7
%38 = load i8, i8* %33
%39 = zext i8 %38 to i32
%40 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds i8, i8* %10, i64 8
%42 = load i8, i8* %37
%43 = zext i8 %42 to i32
%44 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds i8, i8* %10, i64 9
%46 = load i8, i8* %41
%47 = zext i8 %46 to i32
%48 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds i8, i8* %10, i64 10
%50 = load i8, i8* %45
%51 = zext i8 %50 to i32
%52 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds i8, i8* %10, i64 11
%54 = load i8, i8* %49
%55 = zext i8 %54 to i32
%56 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds i8, i8* %10, i64 12
%58 = load i8, i8* %53
%59 = zext i8 %58 to i32
%60 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds i8, i8* %10, i64 13
%62 = load i8, i8* %57
%63 = zext i8 %62 to i32
%64 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds i8, i8* %10, i64 14
%66 = load i8, i8* %61
%67 = zext i8 %66 to i32
%68 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds i8, i8* %10, i64 15
%70 = load i8, i8* %65
%71 = zext i8 %70 to i32
%72 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %71)
%73 = getelementptr inbounds i8, i8* %10, i64 16
%74 = load i8, i8* %69
%75 = zext i8 %74 to i32
%76 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %75)
%77 = add nuw nsw i32 %9, 16
%78 = tail call i32 @putchar(i32 10)
%79 = add nuw nsw i64 %11, 1
%80 = icmp eq i64 %79, %7
br i1 %80, label %81, label %8
81: ; preds = %8, %2
%82 = phi i8* [ %0, %2 ], [ %73, %8 ]
%83 = phi i32 [ 0, %2 ], [ %77, %8 ]
%84 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %83)
%85 = icmp eq i64 %3, 0
br i1 %85, label %95, label %86
86: ; preds = %81, %86
%87 = phi i8* [ %89, %86 ], [ %82, %81 ]
%88 = phi i64 [ %93, %86 ], [ 0, %81 ]
%89 = getelementptr inbounds i8, i8* %87, i64 1
%90 = load i8, i8* %87
%91 = zext i8 %90 to i32
%92 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %91)
%93 = add nuw nsw i64 %88, 1
%94 = icmp eq i64 %93, %3
br i1 %94, label %95, label %86
95: ; preds = %86, %81
%96 = tail call i32 @putchar(i32 10)
ret void
}