#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void fail_printdata(char *text, unsigned char *data, long long len) {
  long long i;
  fprintf(stderr, "%s = {\n    ", text);
  for (i = 0; i < len; ++i) {
    if (i == len - 1) {
      fprintf(stderr, "0x%02x", data[i]);
    } else {
      fprintf(stderr, "0x%02x, ", data[i]);
      if (i % 8 == 7)
        fprintf(stderr, "\n    ");
    }
  }
  fprintf(stderr, "\n};\n");
  fflush(stderr);
}


x86 assembly (clang, -O0):
<fail_printdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    120f <fail_printdata+0xef>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jne    11a2 <fail_printdata+0x82>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11f9 <fail_printdata+0xd9>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
cmp    $0x7,%rdx
jne    11f4 <fail_printdata+0xd4>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11f9 <fail_printdata+0xd9>
jmp    11fe <fail_printdata+0xde>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1157 <fail_printdata+0x37>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
lea    0xdfd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fail_printdata>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%rdx
mov    0x2ea5(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xebb(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %rbx,%rbx
jle    11c0 <fail_printdata+0xa0>
lea    -0x1(%rbx),%r13
lea    0xeb7(%rip),%r12
xor    %r15d,%r15d
jmp    118d <fail_printdata+0x6d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl -0x1(%r14,%rbx,1),%edx
lea    0xe8f(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%r15
cmp    %r15,%rbx
je     11c0 <fail_printdata+0xa0>
mov    0x0(%rbp),%edi
cmp    %r15,%r13
je     1170 <fail_printdata+0x50>
movzbl (%r14,%r15,1),%edx
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r15d,%eax
not    %eax
test   $0x7,%al
jne    1184 <fail_printdata+0x64>
mov    0x0(%rbp),%edi
lea    0xe4f(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1184 <fail_printdata+0x64>
mov    0x0(%rbp),%edi
lea    0xe52(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"%s = {\0A \00"
@.str.1 = [7 x i8] c"0x%02x\00"
@.str.2 = [9 x i8] c"0x%02x, \00"
@.str.3 = [6 x i8] c"\0A \00"
@.str.4 = [5 x i8] c"\0A};\0A\00"
define void @fail_printdata(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %9)
store i64 0, i64* %7
br label %11
11: ; preds = %44, %3
%12 = load i64, i64* %7
%13 = load i64, i64* %6
%14 = icmp slt i64 %12, %13
br i1 %14, label %15, label %47
15: ; preds = %11
%16 = load i64, i64* %7
%17 = load i64, i64* %6
%18 = sub nsw i64 %17, 1
%19 = icmp eq i64 %16, %18
br i1 %19, label %20, label %28
20: ; preds = %15
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %5
%23 = load i64, i64* %7
%24 = getelementptr inbounds i8, i8* %22, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %43
28: ; preds = %15
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %5
%31 = load i64, i64* %7
%32 = getelementptr inbounds i8, i8* %30, i64 %31
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = load i64, i64* %7
%37 = srem i64 %36, 8
%38 = icmp eq i64 %37, 7
br i1 %38, label %39, label %42
39: ; preds = %28
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %39, %28
br label %43
43: ; preds = %42, %20
br label %44
44: ; preds = %43
%45 = load i64, i64* %7
%46 = add nsw i64 %45, 1
store i64 %46, i64* %7
br label %11
47: ; preds = %11
%48 = load i32, i32* @stderr
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%50 = load i32, i32* @stderr
%51 = call i32 @fflush(i32 %50)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"%s = {\0A \00"
@.str.1 = [7 x i8] c"0x%02x\00"
@.str.2 = [9 x i8] c"0x%02x, \00"
@.str.3 = [6 x i8] c"\0A \00"
@.str.4 = [5 x i8] c"\0A};\0A\00"
define void @fail_printdata(i8* %0, i8* nocapture %1, i64 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = icmp sgt i64 %2, 0
br i1 %6, label %7, label %31
7: ; preds = %3
%8 = add nsw i64 %2, -1
%9 = getelementptr inbounds i8, i8* %1, i64 %8
br label %10
10: ; preds = %7, %28
%11 = phi i64 [ 0, %7 ], [ %29, %28 ]
%12 = icmp eq i64 %11, %8
%13 = load i32, i32* @stderr
br i1 %12, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %9
%16 = zext i8 %15 to i32
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %28
18: ; preds = %10
%19 = getelementptr inbounds i8, i8* %1, i64 %11
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = and i64 %11, 7
%24 = icmp eq i64 %23, 7
br i1 %24, label %25, label %28
25: ; preds = %18
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %14, %25, %18
%29 = add nuw nsw i64 %11, 1
%30 = icmp eq i64 %29, %2
br i1 %30, label %31, label %10
31: ; preds = %28, %3
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = tail call i32 @fflush(i32 %34)
ret void
}