#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*/ gg_debug(int, char *, ...);
void gg_dcc_debug_data(const char *prefix, int fd, const void *buf,
                       unsigned int size) {
  unsigned int i;
  gg_debug(16, "++ gg_dcc %s (fd=%d,len=%d)", prefix, fd, size);
  for (i = 0; i < size; i++)
    gg_debug(16, " %.2x", ((unsigned char *)buf)[i]);
  gg_debug(16, "\n");
}


x86 assembly (clang, -O0):
<gg_dcc_debug_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    $0x10,%edi
lea    0xec3(%rip),%rsi
mov    $0x0,%al
call   1030 <gg_debug@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    1183 <gg_dcc_debug_data+0x73>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
mov    $0x10,%edi
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <gg_debug@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114b <gg_dcc_debug_data+0x3b>
mov    $0x10,%edi
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1030 <gg_debug@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gg_dcc_debug_data>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r15
mov    %esi,%ecx
mov    %rdi,%rdx
lea    0xed8(%rip),%rsi
mov    $0x10,%edi
mov    %ebp,%r8d
xor    %eax,%eax
call   1030 <gg_debug@plt>
test   %ebp,%ebp
je     116d <gg_dcc_debug_data+0x5d>
mov    %ebp,%ebp
lea    0xed8(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%edx
mov    $0x10,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <gg_debug@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <gg_dcc_debug_data+0x40>
lea    0xeae(%rip),%rsi
mov    $0x10,%edi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <gg_debug@plt>

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

LLVM IR (-O2):
@.str = [28 x i8] c"++ gg_dcc %s (fd=%d,len=%d)\00"
@.str.1 = [6 x i8] c" %.2x\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @gg_dcc_debug_data(i8* %0, i32 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 (i32, i8*, ...) @gg_debug(i32 16, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32 %3)
%6 = icmp eq i32 %3, 0
br i1 %6, label %17, label %7
7: ; preds = %4
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %15, %9 ]
%11 = getelementptr inbounds i8, i8* %2, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = tail call i32 (i32, i8*, ...) @gg_debug(i32 16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %4
%18 = tail call i32 (i32, i8*, ...) @gg_debug(i32 16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}