#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int ciron_trace_bytes(const char *name, const unsigned char *bytes,
                      size_t len) {
  size_t i;
  fprintf(stderr, "Byte array %s: ", name);
  for (i = 0; i < len; i++) {
    fprintf(stderr, "%s0x%02x", (i == 0) ? "" : ",", bytes[i]);
  }
  fprintf(stderr, "\n");
  return 0;
}


x86 assembly (clang, -O0):
<ciron_trace_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11a3 <ciron_trace_bytes+0x93>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rcx
lea    0xeb0(%rip),%rdx
lea    0xeac(%rip),%rax
cmp    $0x0,%rcx
cmove  %rax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%ecx
lea    0xe85(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1147 <ciron_trace_bytes+0x37>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ciron_trace_bytes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %rbx,%rbx
je     118b <ciron_trace_bytes+0x7b>
lea    0xed5(%rip),%r13
lea    0xecb(%rip),%rbp
lea    0xebb(%rip),%r15
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
test   %r12,%r12
mov    %rbp,%rdx
cmove  %r13,%rdx
movzbl (%r14,%r12,1),%ecx
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%r12
cmp    %r12,%rbx
jne    1160 <ciron_trace_bytes+0x50>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Byte array %s: \00"
@.str.1 = [9 x i8] c"%s0x%02x\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c",\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @ciron_trace_bytes(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 ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %9)
store i64 0, i64* %7
br label %11
11: ; preds = %27, %3
%12 = load i64, i64* %7
%13 = load i64, i64* %6
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %30
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = load i64, i64* %7
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i64
%20 = select i1 %18, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%21 = load i8*, i8** %5
%22 = load i64, i64* %7
%23 = getelementptr inbounds i8, i8* %21, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %20, i32 %25)
br label %27
27: ; preds = %15
%28 = load i64, i64* %7
%29 = add i64 %28, 1
store i64 %29, i64* %7
br label %11
30: ; preds = %11
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Byte array %s: \00"
@.str.1 = [9 x i8] c"%s0x%02x\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c",\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @ciron_trace_bytes(i8* %0, i8* nocapture %1, i64 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = icmp eq i64 %2, 0
br i1 %6, label %18, label %7
7: ; preds = %3, %7
%8 = phi i64 [ %16, %7 ], [ 0, %3 ]
%9 = load i32, i32* @stderr
%10 = icmp eq i64 %8, 0
%11 = select i1 %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%12 = getelementptr inbounds i8, i8* %1, i64 %8
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %14)
%16 = add nuw i64 %8, 1
%17 = icmp eq i64 %16, %2
br i1 %17, label %18, label %7
18: ; preds = %7, %3
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}