#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*/ sprintf(char *, char *, ...);
void dump_mem_tobuffer(char *obuf, char *ibuf, int sz, char *msg, int addr,
                       int bpline) {
  int i, j, k;
  char *line, *s;
  s = obuf;
  for (i = 0; i < 34; i++)
    s += sprintf(s, "*");
  s += sprintf(s, " %s ", msg);
  for (; i > 0; i--)
    s += sprintf(s, "*");
  s += sprintf(s, "\n");
  for (i = 0; i < sz; i += (j * 4)) {
    s += sprintf(s, "%08X:", addr + i);
    for (j = 0; j < (bpline / 4); j++) {
      s += sprintf(s, " %08X", *(((int *)(ibuf + i)) + j));
    }
    s += sprintf(s, "  ");
    line = ibuf + i;
    for (k = 0; k < bpline; k++) {
      if ((line[k] >= 33) && (line[k] <= 126))
        s += sprintf(s, "%c", line[k]);
      else if (line[k] == -1)
        s += sprintf(s, " ");
      else
        s += sprintf(s, ".");
    }
    s += sprintf(s, "\n");
  }
}


x86 assembly (clang, -O0):
<dump_mem_tobuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x22,-0x2c(%rbp)
jge    1178 <dump_mem_tobuffer+0x68>
mov    -0x48(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    113e <dump_mem_tobuffer+0x2e>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe7b(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    11d8 <dump_mem_tobuffer+0xc8>
mov    -0x48(%rbp),%rdi
lea    0xe4d(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    119e <dump_mem_tobuffer+0x8e>
mov    -0x48(%rbp),%rdi
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13e6 <dump_mem_tobuffer+0x2d6>
mov    -0x48(%rbp),%rdi
mov    -0x24(%rbp),%edx
add    -0x2c(%rbp),%edx
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
cmp    %ecx,%eax
jge    129c <dump_mem_tobuffer+0x18c>
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xd98(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    123c <dump_mem_tobuffer+0x12c>
mov    -0x48(%rbp),%rdi
lea    0xd6e(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    13b3 <dump_mem_tobuffer+0x2a3>
mov    -0x40(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x21,%eax
jl     133d <dump_mem_tobuffer+0x22d>
mov    -0x40(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jg     133d <dump_mem_tobuffer+0x22d>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xcf7(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
jmp    13a0 <dump_mem_tobuffer+0x290>
mov    -0x40(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xffffffff,%eax
jne    1379 <dump_mem_tobuffer+0x269>
mov    -0x48(%rbp),%rdi
lea    0xcb9(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
jmp    139b <dump_mem_tobuffer+0x28b>
mov    -0x48(%rbp),%rdi
lea    0xc97(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
jmp    13a0 <dump_mem_tobuffer+0x290>
jmp    13a5 <dump_mem_tobuffer+0x295>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12d4 <dump_mem_tobuffer+0x1c4>
mov    -0x48(%rbp),%rdi
lea    0xc49(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%eax
shl    $0x2,%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1201 <dump_mem_tobuffer+0xf1>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_mem_tobuffer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,(%rsp)
mov    %r8,0x20(%rsp)
mov    %edx,%ebx
mov    %rsi,0x10(%rsp)
mov    %rdi,%rbp
movw   $0x2a,(%rdi)
movw   $0x2a,0x1(%rdi)
movw   $0x2a,0x2(%rdi)
movw   $0x2a,0x3(%rdi)
movw   $0x2a,0x4(%rdi)
movw   $0x2a,0x5(%rdi)
movw   $0x2a,0x6(%rdi)
movw   $0x2a,0x7(%rdi)
movw   $0x2a,0x8(%rdi)
movw   $0x2a,0x9(%rdi)
movw   $0x2a,0xa(%rdi)
movw   $0x2a,0xb(%rdi)
movw   $0x2a,0xc(%rdi)
movw   $0x2a,0xd(%rdi)
movw   $0x2a,0xe(%rdi)
movw   $0x2a,0xf(%rdi)
movw   $0x2a,0x10(%rdi)
movw   $0x2a,0x11(%rdi)
movw   $0x2a,0x12(%rdi)
movw   $0x2a,0x13(%rdi)
movw   $0x2a,0x14(%rdi)
movw   $0x2a,0x15(%rdi)
movw   $0x2a,0x16(%rdi)
movw   $0x2a,0x17(%rdi)
movw   $0x2a,0x18(%rdi)
movw   $0x2a,0x19(%rdi)
movw   $0x2a,0x1a(%rdi)
movw   $0x2a,0x1b(%rdi)
movw   $0x2a,0x1c(%rdi)
movw   $0x2a,0x1d(%rdi)
movw   $0x2a,0x1e(%rdi)
movw   $0x2a,0x1f(%rdi)
movw   $0x2a,0x20(%rdi)
movw   $0x2a,0x21(%rdi)
add    $0x22,%rdi
lea    0xdf9(%rip),%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1030 <sprintf@plt>
cltq
movw   $0x2a,0x22(%rbp,%rax,1)
movw   $0x2a,0x23(%rbp,%rax,1)
movw   $0x2a,0x24(%rbp,%rax,1)
movw   $0x2a,0x25(%rbp,%rax,1)
movw   $0x2a,0x26(%rbp,%rax,1)
movw   $0x2a,0x27(%rbp,%rax,1)
movw   $0x2a,0x28(%rbp,%rax,1)
movw   $0x2a,0x29(%rbp,%rax,1)
movw   $0x2a,0x2a(%rbp,%rax,1)
movw   $0x2a,0x2b(%rbp,%rax,1)
movw   $0x2a,0x2c(%rbp,%rax,1)
movw   $0x2a,0x2d(%rbp,%rax,1)
movw   $0x2a,0x2e(%rbp,%rax,1)
movw   $0x2a,0x2f(%rbp,%rax,1)
movw   $0x2a,0x30(%rbp,%rax,1)
movw   $0x2a,0x31(%rbp,%rax,1)
movw   $0x2a,0x32(%rbp,%rax,1)
movw   $0x2a,0x33(%rbp,%rax,1)
movw   $0x2a,0x34(%rbp,%rax,1)
movw   $0x2a,0x35(%rbp,%rax,1)
movw   $0x2a,0x36(%rbp,%rax,1)
movw   $0x2a,0x37(%rbp,%rax,1)
movw   $0x2a,0x38(%rbp,%rax,1)
movw   $0x2a,0x39(%rbp,%rax,1)
movw   $0x2a,0x3a(%rbp,%rax,1)
movw   $0x2a,0x3b(%rbp,%rax,1)
movw   $0x2a,0x3c(%rbp,%rax,1)
movw   $0x2a,0x3d(%rbp,%rax,1)
movw   $0x2a,0x3e(%rbp,%rax,1)
movw   $0x2a,0x3f(%rbp,%rax,1)
movw   $0x2a,0x40(%rbp,%rax,1)
movw   $0x2a,0x41(%rbp,%rax,1)
movw   $0x2a,0x42(%rbp,%rax,1)
movw   $0x2a,0x43(%rbp,%rax,1)
movw   $0xa,0x44(%rbp,%rax,1)
mov    %ebx,0xc(%rsp)
test   %ebx,%ebx
jle    144b <dump_mem_tobuffer+0x33b>
lea    (%rax,%rbp,1),%r12
add    $0x43,%r12
add    $0x2,%r12
mov    (%rsp),%rax
lea    0x3(%rax),%r15d
test   %eax,%eax
cmovns %eax,%r15d
sar    $0x2,%r15d
mov    %eax,%r13d
lea    0xcc9(%rip),%rbp
lea    0xcc8(%rip),%r14
xor    %ebx,%ebx
jmp    136b <dump_mem_tobuffer+0x25b>
nopw   0x0(%rax,%rax,1)
add    %rax,%r12
movw   $0xa,(%r12)
lea    (%rdi,%rbx,4),%ebx
add    $0x1,%r12
cmp    0xc(%rsp),%ebx
jge    144b <dump_mem_tobuffer+0x33b>
mov    0x20(%rsp),%rax
lea    (%rbx,%rax,1),%edx
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <sprintf@plt>
cltq
add    %r12,%rax
mov    %ebx,%edi
cmpl   $0x4,(%rsp)
jl     13e0 <dump_mem_tobuffer+0x2d0>
mov    0x10(%rsp),%rcx
mov    %rdi,0x18(%rsp)
lea    (%rcx,%rdi,1),%r12
xor    %ebp,%ebp
nopl   (%rax)
mov    %rax,%rbx
mov    (%r12,%rbp,4),%edx
mov    %rax,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <sprintf@plt>
cltq
add    %rbx,%rax
add    $0x1,%rbp
cmp    %rbp,%r15
jne    13a0 <dump_mem_tobuffer+0x290>
mov    %r15d,%ebx
lea    0xc39(%rip),%rbp
mov    0x18(%rsp),%rdi
jmp    13e2 <dump_mem_tobuffer+0x2d2>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %ebx,%ebx
lea    0x2(%rax),%r12
movb   $0x0,0x2(%rax)
movw   $0x2020,(%rax)
cmpl   $0x0,(%rsp)
jle    1353 <dump_mem_tobuffer+0x243>
mov    0x10(%rsp),%rax
lea    (%rax,%rdi,1),%rcx
xor    %eax,%eax
jmp    1427 <dump_mem_tobuffer+0x317>
cs nopw 0x0(%rax,%rax,1)
mov    %dl,(%r12,%rax,1)
movb   $0x0,0x1(%r12,%rax,1)
add    $0x1,%rax
cmp    %rax,%r13
je     1350 <dump_mem_tobuffer+0x240>
movzbl (%rcx,%rax,1),%edx
lea    -0x7f(%rdx),%esi
cmp    $0xa2,%sil
jae    1410 <dump_mem_tobuffer+0x300>
cmp    $0xff,%dl
je     1442 <dump_mem_tobuffer+0x332>
movw   $0x2e,(%r12,%rax,1)
jmp    141a <dump_mem_tobuffer+0x30a>
movw   $0x20,(%r12,%rax,1)
jmp    141a <dump_mem_tobuffer+0x30a>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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