#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;
  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)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11dc <show_bytecode+0xbc>
mov    -0x34(%rbp),%esi
lea    0xe91(%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    11bf <show_bytecode+0x9f>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%esi
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1185 <show_bytecode+0x65>
lea    0xe41(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1157 <show_bytecode+0x37>
mov    -0x34(%rbp),%esi
lea    0xe1a(%rip),%rdi
call   1040 <printf@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    1230 <show_bytecode+0x110>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%esi
lea    0xdee(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11f3 <show_bytecode+0xd3>
lea    0xdd0(%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
xor    %ebx,%ebx
cmp    $0x10,%rsi
jb     1264 <show_bytecode+0x144>
shr    $0x4,%r15
xor    %ebx,%ebx
lea    0xeaf(%rip),%rbp
lea    0xeb0(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
movzbl (%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0x1(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0x2(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0x3(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0x4(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0x5(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0x6(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0x7(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0x8(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0x9(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0xa(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0xb(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0xc(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0xd(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0xe(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
movzbl 0xf(%r14,%rbx,1),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rbx
add    $0xffffffffffffffff,%r15
jne    1160 <show_bytecode+0x40>
add    %rbx,%r14
lea    0xd95(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
test   %r12,%r12
je     1296 <show_bytecode+0x176>
xor    %ebp,%ebp
lea    0xd88(%rip),%rbx
movzbl (%r14,%rbp,1),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1280 <show_bytecode+0x160>
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 = [8 x i8] c"0x%04x:\00"
@.str.1 = [6 x i8] c" %02x\00"
@.str.2 = [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
store i64 0, i64* %5
br label %14
14: ; preds = %37, %2
%15 = load i64, i64* %5
%16 = load i64, i64* %7
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %40
18: ; preds = %14
%19 = load i32, i32* %9
%20 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %9
%22 = add nsw i32 %21, 16
store i32 %22, i32* %9
store i64 0, i64* %6
br label %23
23: ; preds = %32, %18
%24 = load i64, i64* %6
%25 = icmp ult i64 %24, 16
br i1 %25, label %26, label %35
26: ; preds = %23
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
%29 = load i8, i8* %27
%30 = zext i8 %29 to i32
%31 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %26
%33 = load i64, i64* %6
%34 = add i64 %33, 1
store i64 %34, i64* %6
br label %23
35: ; preds = %23
%36 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i64, i64* %5
%39 = add i64 %38, 1
store i64 %39, i64* %5
br label %14
40: ; preds = %14
%41 = load i32, i32* %9
%42 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %41)
store i64 0, i64* %5
br label %43
43: ; preds = %53, %40
%44 = load i64, i64* %5
%45 = load i64, i64* %8
%46 = icmp ult i64 %44, %45
br i1 %46, label %47, label %56
47: ; preds = %43
%48 = load i8*, i8** %3
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %3
%50 = load i8, i8* %48
%51 = zext i8 %50 to i32
%52 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %47
%54 = load i64, i64* %5
%55 = add i64 %54, 1
store i64 %55, i64* %5
br label %43
56: ; preds = %43
%57 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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