#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 */
struct ss7 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ss7_message(struct ss7 *, char *, ...);
void isup_dump_buffer(struct ss7 *ss7, unsigned char *data, int len) {
  int i;
  ss7_message(ss7, "[");
  for (i = 0; i < len; i++) {
    ss7_message(ss7, "0x%x ", data[i]);
  }
  ss7_message(ss7, "]\n");
}


x86 assembly (clang, -O0):
<isup_dump_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
mov    $0x0,%al
call   1030 <ss7_message@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1174 <isup_dump_buffer+0x64>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xea3(%rip),%rsi
mov    $0x0,%al
call   1030 <ss7_message@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113c <isup_dump_buffer+0x2c>
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1030 <ss7_message@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isup_dump_buffer>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xed9(%rip),%rsi
xor    %eax,%eax
call   1030 <ss7_message@plt>
test   %ebp,%ebp
jle    115b <isup_dump_buffer+0x4b>
mov    %ebp,%ebp
lea    0xec7(%rip),%r15
xor    %ebx,%ebx
nopl   (%rax)
movzbl (%r14,%rbx,1),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <ss7_message@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <isup_dump_buffer+0x30>
lea    0xea6(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <ss7_message@plt>

LLVM IR (-O0):
%struct.ss7 = type { i32 }
@.str = [2 x i8] c"[\00"
@.str.1 = [6 x i8] c"0x%x \00"
@.str.2 = [3 x i8] c"]\0A\00"
define void @isup_dump_buffer(%struct.ss7* %0, i8* %1, i32 %2) {
%4 = alloca %struct.ss7*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store %struct.ss7* %0, %struct.ss7** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load %struct.ss7*, %struct.ss7** %4
%9 = call i32 (%struct.ss7*, i8*, ...) @ss7_message(%struct.ss7* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %10
10: ; preds = %23, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %26
14: ; preds = %10
%15 = load %struct.ss7*, %struct.ss7** %4
%16 = load i8*, i8** %5
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = call i32 (%struct.ss7*, i8*, ...) @ss7_message(%struct.ss7* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %14
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %10
26: ; preds = %10
%27 = load %struct.ss7*, %struct.ss7** %4
%28 = call i32 (%struct.ss7*, i8*, ...) @ss7_message(%struct.ss7* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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