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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int output_ice(const char *name, unsigned char *arr, size_t size, FILE *fdo) {
  size_t i;
  fprintf(fdo, "%s | %lu bytes\n\"", name, (unsigned long)size);
  for (i = 0; i < size; ++i) {
    fprintf(fdo, "%02X", arr[i]);
  }
  fprintf(fdo, "\"\n");
  return 0;
}


x86 assembly (clang, -O0):
<output_ice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1187 <output_ice+0x77>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    114a <output_ice+0x3a>
mov    -0x20(%rbp),%rdi
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_ice>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%rdx
lea    0xec4(%rip),%rsi
mov    %rcx,%rdi
mov    %r13,%rcx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r13,%r13
je     117b <output_ice+0x5b>
lea    0xebc(%rip),%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%edx
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1160 <output_ice+0x40>
lea    0xe94(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fwrite@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"%s | %lu bytes\0A\22\00"
@.str.1 = [5 x i8] c"%02X\00"
@.str.2 = [3 x i8] c"\22\0A\00"
define i32 @output_ice(i8* %0, i8* %1, i64 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32*
%9 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%10 = load i32*, i32** %8
%11 = load i8*, i8** %5
%12 = load i64, i64* %7
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %11, i64 %12)
store i64 0, i64* %9
br label %14
14: ; preds = %26, %4
%15 = load i64, i64* %9
%16 = load i64, i64* %7
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = load i32*, i32** %8
%20 = load i8*, i8** %6
%21 = load i64, i64* %9
%22 = getelementptr inbounds i8, i8* %20, i64 %21
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %18
%27 = load i64, i64* %9
%28 = add i64 %27, 1
store i64 %28, i64* %9
br label %14
29: ; preds = %14
%30 = load i32*, i32** %8
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"%s | %lu bytes\0A\22\00"
@.str.1 = [5 x i8] c"%02X\00"
@.str.2 = [3 x i8] c"\22\0A\00"
define i32 @output_ice(i8* %0, i8* nocapture %1, i64 %2, i32* nocapture %3) {
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %2)
%6 = icmp eq i64 %2, 0
br i1 %6, label %15, label %7
7: ; preds = %4, %7
%8 = phi i64 [ %13, %7 ], [ 0, %4 ]
%9 = getelementptr inbounds i8, i8* %1, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = add nuw i64 %8, 1
%14 = icmp eq i64 %13, %2
br i1 %14, label %15, label %7
15: ; preds = %7, %4
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %3)
ret i32 0
}