#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 /*<<< orphan*/ hex;

/* Variables and functions */
scalar_t__ isprint(unsigned char);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
void printhex2(char *start, void *dst, int len, char *end) {
  unsigned char *p = NULL;
  int i, j;
  unsigned char hex[16];
  printf("len = [%d]\n", len);
  memset(hex, 0, sizeof(hex));
  if (start != NULL)
    printf("%s", start);
  printf("%08X:  ", 0);
  for (p = (unsigned char *)dst, i = 0, j = 0; i < len; i++, p++) {
    hex[j++] = *p;
    if (j == 16) {
      for (j = 0; j <= 15; ++j)
        printf("%02x%s", hex[j], j == 7 ? "  " : " ");
      printf("    ");
      for (j = 0; j <= 15; ++j)
        printf("%c%s", isprint(hex[j]) ? hex[j] : '.', j == 7 ? " " : "");
      printf("\n%08X:  ", i + 1);
      j = 0;
    }
  }
  if (j != 0) {
    for (i = 0; i < j; ++i)
      printf("%02x%s", hex[i], i == 7 ? "  " : " ");
    for (; i <= 15; ++i)
      printf("%02c%s", ' ', i == 7 ? "  " : " ");
    printf("    ");
    for (i = 0; i < j; ++i)
      printf("%c%s", isprint(hex[i]) ? hex[i] : '.', i == 7 ? " " : "");
    for (; i <= 15; ++i)
      printf("%c%s", ' ', i == 7 ? " " : "");
  }
  printf("\n");
  if (end != NULL)
    printf("%s", end);
}


x86 assembly (clang, -O0):
<printhex2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x14(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
cmpq   $0x0,-0x8(%rbp)
je     118d <printhex2+0x5d>
mov    -0x8(%rbp),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8a(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12f4 <printhex2+0x1c4>
mov    -0x28(%rbp),%rax
mov    (%rax),%cl
mov    -0x30(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x30(%rbp)
cltq
mov    %cl,-0x40(%rbp,%rax,1)
cmpl   $0x10,-0x30(%rbp)
jne    12d5 <printhex2+0x1a5>
movl   $0x0,-0x30(%rbp)
cmpl   $0xf,-0x30(%rbp)
jg     122e <printhex2+0xfe>
movslq -0x30(%rbp),%rax
movzbl -0x40(%rbp,%rax,1),%esi
mov    -0x30(%rbp),%ecx
lea    0xe12(%rip),%rdx
lea    0xe0a(%rip),%rax
cmp    $0x7,%ecx
cmove  %rax,%rdx
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11e7 <printhex2+0xb7>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
cmpl   $0xf,-0x30(%rbp)
jg     12ba <printhex2+0x18a>
movslq -0x30(%rbp),%rax
movzbl -0x40(%rbp,%rax,1),%edi
call   1050 <isprint@plt>
cmp    $0x0,%rax
je     1276 <printhex2+0x146>
movslq -0x30(%rbp),%rax
movzbl -0x40(%rbp,%rax,1),%eax
mov    %eax,-0x44(%rbp)
jmp    1283 <printhex2+0x153>
mov    $0x2e,%eax
mov    %eax,-0x44(%rbp)
jmp    1283 <printhex2+0x153>
mov    -0x44(%rbp),%esi
mov    -0x30(%rbp),%ecx
lea    0xd7b(%rip),%rdx
lea    0xd7f(%rip),%rax
cmp    $0x7,%ecx
cmove  %rax,%rdx
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1243 <printhex2+0x113>
mov    -0x2c(%rbp),%esi
add    $0x1,%esi
lea    0xd56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
jmp    12da <printhex2+0x1aa>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11b3 <printhex2+0x83>
cmpl   $0x0,-0x30(%rbp)
je     1471 <printhex2+0x341>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    134e <printhex2+0x21e>
movslq -0x2c(%rbp),%rax
movzbl -0x40(%rbp,%rax,1),%esi
mov    -0x2c(%rbp),%ecx
lea    0xcf2(%rip),%rdx
lea    0xcea(%rip),%rax
cmp    $0x7,%ecx
cmove  %rax,%rdx
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1305 <printhex2+0x1d5>
jmp    1353 <printhex2+0x223>
cmpl   $0xf,-0x2c(%rbp)
jg     1396 <printhex2+0x266>
mov    -0x2c(%rbp),%ecx
lea    0xcaf(%rip),%rdx
lea    0xca7(%rip),%rax
cmp    $0x7,%ecx
cmove  %rax,%rdx
lea    0xcaa(%rip),%rdi
mov    $0x20,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1353 <printhex2+0x223>
lea    0xc76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1424 <printhex2+0x2f4>
movslq -0x2c(%rbp),%rax
movzbl -0x40(%rbp,%rax,1),%edi
call   1050 <isprint@plt>
cmp    $0x0,%rax
je     13e0 <printhex2+0x2b0>
movslq -0x2c(%rbp),%rax
movzbl -0x40(%rbp,%rax,1),%eax
mov    %eax,-0x48(%rbp)
jmp    13ed <printhex2+0x2bd>
mov    $0x2e,%eax
mov    %eax,-0x48(%rbp)
jmp    13ed <printhex2+0x2bd>
mov    -0x48(%rbp),%esi
mov    -0x2c(%rbp),%ecx
lea    0xc11(%rip),%rdx
lea    0xc15(%rip),%rax
cmp    $0x7,%ecx
cmove  %rax,%rdx
lea    0xc09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13ab <printhex2+0x27b>
jmp    1429 <printhex2+0x2f9>
cmpl   $0xf,-0x2c(%rbp)
jg     146c <printhex2+0x33c>
mov    -0x2c(%rbp),%ecx
lea    0xbce(%rip),%rdx
lea    0xbd2(%rip),%rax
cmp    $0x7,%ecx
cmove  %rax,%rdx
lea    0xbc6(%rip),%rdi
mov    $0x20,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1429 <printhex2+0x2f9>
jmp    1471 <printhex2+0x341>
lea    0xb92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
je     149c <printhex2+0x36c>
mov    -0x20(%rbp),%rsi
lea    0xb85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printhex2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,0x20(%rsp)
mov    %rsi,%r13
mov    %rdi,%rbx
lea    0xea0(%rip),%rdi
mov    %edx,0x18(%rsp)
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
test   %rbx,%rbx
je     1192 <printhex2+0x52>
lea    0xe92(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe85(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x18(%rsp)
jle    14bd <printhex2+0x37d>
lea    0xe62(%rip),%rbx
lea    0xe5a(%rip),%rbp
lea    0xe49(%rip),%r12
lea    0xe4f(%rip),%r14
xor    %r15d,%r15d
xor    %edx,%edx
jmp    1201 <printhex2+0xc1>
mov    0x1c(%rsp),%ebp
add    $0x1,%ebp
xor    %r15d,%r15d
lea    0xe3c(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edx
lea    0xe22(%rip),%rbp
add    $0x1,%r13
cmp    0x18(%rsp),%edx
je     13a8 <printhex2+0x268>
mov    0x0(%r13),%al
movslq %r15d,%rcx
add    $0x1,%r15d
mov    %al,(%rsp,%rcx,1)
cmp    $0x10,%r15d
jne    13a0 <printhex2+0x260>
mov    %edx,0x1c(%rsp)
mov    %rbp,%r15
movzbl (%rsp),%esi
lea    0xde1(%rip),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x1(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x2(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x3(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x4(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x5(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x6(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x7(%rsp),%esi
mov    %rbp,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x8(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x9(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xa(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xb(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xc(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xd(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xe(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcc6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebp,%ebp
jmp    1387 <printhex2+0x247>
nopl   0x0(%rax,%rax,1)
movzbl (%rsp,%rbp,1),%esi
cmp    $0x7,%rbp
mov    %r12,%rdx
cmove  %rbx,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    $0x10,%rbp
je     11d0 <printhex2+0x90>
movzbl (%rsp,%rbp,1),%edi
call   1060 <isprint@plt>
test   %rax,%rax
jne    1360 <printhex2+0x220>
mov    $0x2e,%esi
jmp    1364 <printhex2+0x224>
nopl   0x0(%rax)
add    $0x1,%edx
jmp    11f3 <printhex2+0xb3>
test   %r15d,%r15d
je     14bd <printhex2+0x37d>
mov    %rbp,%r14
mov    %r15d,%r13d
jle    13f1 <printhex2+0x2b1>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%rsp,%rbp,1),%esi
cmp    $0x7,%rbp
mov    %rbx,%rdx
cmove  %r14,%rdx
lea    0xc36(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    13c0 <printhex2+0x280>
mov    %r15d,%ebp
cmp    $0xf,%r15d
jbe    13f3 <printhex2+0x2b3>
jmp    1421 <printhex2+0x2e1>
xor    %ebp,%ebp
add    $0xfffffff0,%ebp
cs nopw 0x0(%rax,%rax,1)
cmp    $0xfffffff7,%ebp
mov    %rbx,%rdx
cmove  %r14,%rdx
lea    0xc15(%rip),%rdi
mov    $0x20,%esi
xor    %eax,%eax
call   1040 <printf@plt>
inc    %ebp
jne    1400 <printhex2+0x2c0>
lea    0xbeb(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15d,%r15d
jle    1490 <printhex2+0x350>
lea    0xbdb(%rip),%r14
xor    %ebp,%ebp
jmp    1472 <printhex2+0x332>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rsp,%rbp,1),%esi
cmp    $0x7,%rbp
mov    %r12,%rdx
cmove  %rbx,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
je     1487 <printhex2+0x347>
movzbl (%rsp,%rbp,1),%edi
call   1060 <isprint@plt>
test   %rax,%rax
jne    1450 <printhex2+0x310>
mov    $0x2e,%esi
jmp    1454 <printhex2+0x314>
mov    %r15d,%ebp
cmp    $0xf,%r15d
ja     14bd <printhex2+0x37d>
add    $0xfffffff0,%ebp
lea    0xb7e(%rip),%r14
nopw   0x0(%rax,%rax,1)
cmp    $0xfffffff7,%ebp
mov    %r12,%rdx
cmove  %rbx,%rdx
mov    %r14,%rdi
mov    $0x20,%esi
xor    %eax,%eax
call   1040 <printf@plt>
inc    %ebp
jne    14a0 <printhex2+0x360>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x20(%rsp),%rsi
test   %rsi,%rsi
je     14df <printhex2+0x39f>
lea    0xb42(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"len = [%d]\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [8 x i8] c"%08X: \00"
@.str.3 = [7 x i8] c"%02x%s\00"
@.str.4 = [3 x i8] c" \00"
@.str.5 = [2 x i8] c" \00"
@.str.6 = [5 x i8] c" \00"
@.str.7 = [5 x i8] c"%c%s\00"
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [9 x i8] c"\0A%08X: \00"
@.str.10 = [7 x i8] c"%02c%s\00"
@.str.11 = [2 x i8] c"\0A\00"
define void @printhex2(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca [16 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
store i8* null, i8** %9
%13 = load i32, i32* %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 0
%16 = call i32 @memset(i8* %15, i32 0, i32 16)
%17 = load i8*, i8** %5
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %22
19: ; preds = %4
%20 = load i8*, i8** %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %19, %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 0)
%24 = load i8*, i8** %6
store i8* %24, i8** %9
store i32 0, i32* %10
store i32 0, i32* %11
br label %25
25: ; preds = %90, %22
%26 = load i32, i32* %10
%27 = load i32, i32* %7
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %95
29: ; preds = %25
%30 = load i8*, i8** %9
%31 = load i8, i8* %30
%32 = load i32, i32* %11
%33 = add nsw i32 %32, 1
store i32 %33, i32* %11
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 %34
store i8 %31, i8* %35
%36 = load i32, i32* %11
%37 = icmp eq i32 %36, 16
br i1 %37, label %38, label %89
38: ; preds = %29
store i32 0, i32* %11
br label %39
39: ; preds = %53, %38
%40 = load i32, i32* %11
%41 = icmp sle i32 %40, 15
br i1 %41, label %42, label %56
42: ; preds = %39
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = load i32, i32* %11
%49 = icmp eq i32 %48, 7
%50 = zext i1 %49 to i64
%51 = select i1 %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %47, i8* %51)
br label %53
53: ; preds = %42
%54 = load i32, i32* %11
%55 = add nsw i32 %54, 1
store i32 %55, i32* %11
br label %39
56: ; preds = %39
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %11
br label %58
58: ; preds = %82, %56
%59 = load i32, i32* %11
%60 = icmp sle i32 %59, 15
br i1 %60, label %61, label %85
61: ; preds = %58
%62 = load i32, i32* %11
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = call i64 @isprint(i8 zeroext %65)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %74
68: ; preds = %61
%69 = load i32, i32* %11
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
br label %75
74: ; preds = %61
br label %75
75: ; preds = %74, %68
%76 = phi i32 [ %73, %68 ], [ 46, %74 ]
%77 = load i32, i32* %11
%78 = icmp eq i32 %77, 7
%79 = zext i1 %78 to i64
%80 = select i1 %78, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %76, i8* %80)
br label %82
82: ; preds = %75
%83 = load i32, i32* %11
%84 = add nsw i32 %83, 1
store i32 %84, i32* %11
br label %58
85: ; preds = %58
%86 = load i32, i32* %10
%87 = add nsw i32 %86, 1
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i32 %87)
store i32 0, i32* %11
br label %89
89: ; preds = %85, %29
br label %90
90: ; preds = %89
%91 = load i32, i32* %10
%92 = add nsw i32 %91, 1
store i32 %92, i32* %10
%93 = load i8*, i8** %9
%94 = getelementptr inbounds i8, i8* %93, i32 1
store i8* %94, i8** %9
br label %25
95: ; preds = %25
%96 = load i32, i32* %11
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %174
98: ; preds = %95
store i32 0, i32* %10
br label %99
99: ; preds = %114, %98
%100 = load i32, i32* %10
%101 = load i32, i32* %11
%102 = icmp slt i32 %100, %101
br i1 %102, label %103, label %117
103: ; preds = %99
%104 = load i32, i32* %10
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 %105
%107 = load i8, i8* %106
%108 = zext i8 %107 to i32
%109 = load i32, i32* %10
%110 = icmp eq i32 %109, 7
%111 = zext i1 %110 to i64
%112 = select i1 %110, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %108, i8* %112)
br label %114
114: ; preds = %103
%115 = load i32, i32* %10
%116 = add nsw i32 %115, 1
store i32 %116, i32* %10
br label %99
117: ; preds = %99
br label %118
118: ; preds = %127, %117
%119 = load i32, i32* %10
%120 = icmp sle i32 %119, 15
br i1 %120, label %121, label %130
121: ; preds = %118
%122 = load i32, i32* %10
%123 = icmp eq i32 %122, 7
%124 = zext i1 %123 to i64
%125 = select i1 %123, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i32 32, i8* %125)
br label %127
127: ; preds = %121
%128 = load i32, i32* %10
%129 = add nsw i32 %128, 1
store i32 %129, i32* %10
br label %118
130: ; preds = %118
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %10
br label %132
132: ; preds = %157, %130
%133 = load i32, i32* %10
%134 = load i32, i32* %11
%135 = icmp slt i32 %133, %134
br i1 %135, label %136, label %160
136: ; preds = %132
%137 = load i32, i32* %10
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 %138
%140 = load i8, i8* %139
%141 = call i64 @isprint(i8 zeroext %140)
%142 = icmp ne i64 %141, 0
br i1 %142, label %143, label %149
143: ; preds = %136
%144 = load i32, i32* %10
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 %145
%147 = load i8, i8* %146
%148 = zext i8 %147 to i32
br label %150
149: ; preds = %136
br label %150
150: ; preds = %149, %143
%151 = phi i32 [ %148, %143 ], [ 46, %149 ]
%152 = load i32, i32* %10
%153 = icmp eq i32 %152, 7
%154 = zext i1 %153 to i64
%155 = select i1 %153, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %151, i8* %155)
br label %157
157: ; preds = %150
%158 = load i32, i32* %10
%159 = add nsw i32 %158, 1
store i32 %159, i32* %10
br label %132
160: ; preds = %132
br label %161
161: ; preds = %170, %160
%162 = load i32, i32* %10
%163 = icmp sle i32 %162, 15
br i1 %163, label %164, label %173
164: ; preds = %161
%165 = load i32, i32* %10
%166 = icmp eq i32 %165, 7
%167 = zext i1 %166 to i64
%168 = select i1 %166, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 32, i8* %168)
br label %170
170: ; preds = %164
%171 = load i32, i32* %10
%172 = add nsw i32 %171, 1
store i32 %172, i32* %10
br label %161
173: ; preds = %161
br label %174
174: ; preds = %173, %95
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%176 = load i8*, i8** %8
%177 = icmp ne i8* %176, null
br i1 %177, label %178, label %181
178: ; preds = %174
%179 = load i8*, i8** %8
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %179)
br label %181
181: ; preds = %178, %174
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"len = [%d]\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [8 x i8] c"%08X: \00"
@.str.3 = [7 x i8] c"%02x%s\00"
@.str.4 = [3 x i8] c" \00"
@.str.5 = [2 x i8] c" \00"
@.str.6 = [5 x i8] c" \00"
@.str.7 = [5 x i8] c"%c%s\00"
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [9 x i8] c"\0A%08X: \00"
@.str.10 = [7 x i8] c"%02c%s\00"
define void @printhex2(i8* %0, i8* nocapture %1, i32 %2, i8* %3) {
%5 = alloca [16 x i8]
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2)
%8 = call i32 @memset(i8* %6, i32 0, i32 16)
%9 = icmp eq i8* %0, null
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %10, %4
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 0)
%14 = icmp sgt i32 %2, 0
br i1 %14, label %15, label %174
15: ; preds = %12
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 1
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 2
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 3
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 4
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 5
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 6
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 7
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 8
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 9
%25 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 10
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 11
%27 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 12
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 13
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 14
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 15
br label %31
31: ; preds = %15, %111
%32 = phi i32 [ %113, %111 ], [ 0, %15 ]
%33 = phi i32 [ %112, %111 ], [ 0, %15 ]
%34 = phi i8* [ %114, %111 ], [ %1, %15 ]
%35 = load i8, i8* %34
%36 = add nsw i32 %32, 1
%37 = sext i32 %32 to i64
%38 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 %37
store i8 %35, i8* %38
%39 = icmp eq i32 %36, 16
br i1 %39, label %42, label %40
40: ; preds = %31
%41 = add nuw nsw i32 %33, 1
br label %111
42: ; preds = %31
%43 = load i8, i8* %6
%44 = zext i8 %43 to i32
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%46 = load i8, i8* %16
%47 = zext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%49 = load i8, i8* %17
%50 = zext i8 %49 to i32
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%52 = load i8, i8* %18
%53 = zext i8 %52 to i32
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%55 = load i8, i8* %19
%56 = zext i8 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%58 = load i8, i8* %20
%59 = zext i8 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%61 = load i8, i8* %21
%62 = zext i8 %61 to i32
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%64 = load i8, i8* %22
%65 = zext i8 %64 to i32
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%67 = load i8, i8* %23
%68 = zext i8 %67 to i32
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%70 = load i8, i8* %24
%71 = zext i8 %70 to i32
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%73 = load i8, i8* %25
%74 = zext i8 %73 to i32
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%76 = load i8, i8* %26
%77 = zext i8 %76 to i32
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%79 = load i8, i8* %27
%80 = zext i8 %79 to i32
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%82 = load i8, i8* %28
%83 = zext i8 %82 to i32
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%85 = load i8, i8* %29
%86 = zext i8 %85 to i32
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%88 = load i8, i8* %30
%89 = zext i8 %88 to i32
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %92
92: ; preds = %42, %101
%93 = phi i64 [ 0, %42 ], [ %106, %101 ]
%94 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 %93
%95 = load i8, i8* %94
%96 = call i64 @isprint(i8 zeroext %95)
%97 = icmp eq i64 %96, 0
br i1 %97, label %101, label %98
98: ; preds = %92
%99 = load i8, i8* %94
%100 = zext i8 %99 to i32
br label %101
101: ; preds = %92, %98
%102 = phi i32 [ %100, %98 ], [ 46, %92 ]
%103 = icmp eq i64 %93, 7
%104 = select i1 %103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %102, i8* %104)
%106 = add nuw nsw i64 %93, 1
%107 = icmp eq i64 %106, 16
br i1 %107, label %108, label %92
108: ; preds = %101
%109 = add nuw nsw i32 %33, 1
%110 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i32 %109)
br label %111
111: ; preds = %40, %108
%112 = phi i32 [ %41, %40 ], [ %109, %108 ]
%113 = phi i32 [ %36, %40 ], [ 0, %108 ]
%114 = getelementptr inbounds i8, i8* %34, i64 1
%115 = icmp eq i32 %112, %2
br i1 %115, label %116, label %31
116: ; preds = %111
%117 = icmp eq i32 %113, 0
br i1 %117, label %174, label %118
118: ; preds = %116
%119 = icmp sgt i32 %113, 0
br i1 %119, label %120, label %124
120: ; preds = %118
%121 = zext i32 %113 to i64
br label %126
122: ; preds = %126
%123 = icmp ult i32 %113, 16
br i1 %123, label %124, label %143
124: ; preds = %118, %122
%125 = phi i32 [ 0, %118 ], [ %113, %122 ]
br label %136
126: ; preds = %120, %126
%127 = phi i64 [ 0, %120 ], [ %134, %126 ]
%128 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 %127
%129 = load i8, i8* %128
%130 = zext i8 %129 to i32
%131 = icmp eq i64 %127, 7
%132 = select i1 %131, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %130, i8* %132)
%134 = add nuw nsw i64 %127, 1
%135 = icmp eq i64 %134, %121
br i1 %135, label %122, label %126
136: ; preds = %124, %136
%137 = phi i32 [ %141, %136 ], [ %125, %124 ]
%138 = icmp eq i32 %137, 7
%139 = select i1 %138, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i32 32, i8* %139)
%141 = add nuw i32 %137, 1
%142 = icmp eq i32 %141, 16
br i1 %142, label %143, label %136
143: ; preds = %136, %122
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br i1 %119, label %145, label %149
145: ; preds = %143
%146 = zext i32 %113 to i64
br label %151
147: ; preds = %160
%148 = icmp ult i32 %113, 16
br i1 %148, label %149, label %174
149: ; preds = %143, %147
%150 = phi i32 [ 0, %143 ], [ %113, %147 ]
br label %167
151: ; preds = %145, %160
%152 = phi i64 [ 0, %145 ], [ %165, %160 ]
%153 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 %152
%154 = load i8, i8* %153
%155 = call i64 @isprint(i8 zeroext %154)
%156 = icmp eq i64 %155, 0
br i1 %156, label %160, label %157
157: ; preds = %151
%158 = load i8, i8* %153
%159 = zext i8 %158 to i32
br label %160
160: ; preds = %151, %157
%161 = phi i32 [ %159, %157 ], [ 46, %151 ]
%162 = icmp eq i64 %152, 7
%163 = select i1 %162, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%164 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %161, i8* %163)
%165 = add nuw nsw i64 %152, 1
%166 = icmp eq i64 %165, %146
br i1 %166, label %147, label %151
167: ; preds = %149, %167
%168 = phi i32 [ %172, %167 ], [ %150, %149 ]
%169 = icmp eq i32 %168, 7
%170 = select i1 %169, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%171 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 32, i8* %170)
%172 = add nuw i32 %168, 1
%173 = icmp eq i32 %172, 16
br i1 %173, label %174, label %167
174: ; preds = %167, %12, %147, %116
%175 = call i32 @putchar(i32 10)
%176 = icmp eq i8* %3, null
br i1 %176, label %179, label %177
177: ; preds = %174
%178 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %179
179: ; preds = %177, %174
ret void
}