#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 sockaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
char *UNSPEC_print(unsigned char *ptr) {
  static char buff[sizeof(struct sockaddr) * 3 + 1];
  char *pos;
  unsigned int i;
  pos = buff;
  for (i = 0; i < sizeof(struct sockaddr); i++) {
    sprintf(pos, "%02X-", (*ptr++ & 0377));
    pos += 3;
  }
  *--pos = '\0';
  return (buff);
}


x86 assembly (clang, -O0):
<UNSPEC_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f06(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    $0x4,%rax
jae    117d <UNSPEC_print+0x6d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%edx
and    $0xff,%edx
lea    0xea2(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <UNSPEC_print+0x1e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,-0x1(%rax)
lea    0x2e92(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UNSPEC_print>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
movzbl (%rdi),%edx
lea    0x2f07(%rip),%r14
lea    0xed7(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <sprintf@plt>
movzbl 0x1(%rbx),%edx
lea    0x2eed(%rip),%rdi
mov    %r15,%rsi
call   1030 <sprintf@plt>
movzbl 0x2(%rbx),%edx
lea    0x2edd(%rip),%rdi
mov    %r15,%rsi
call   1030 <sprintf@plt>
movzbl 0x3(%rbx),%edx
lea    0x2ecd(%rip),%rdi
mov    %r15,%rsi
call   1030 <sprintf@plt>
movb   $0x0,0x2ec0(%rip)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@UNSPEC_print.buff = internal global [13 x i8] zeroinitializer
@.str = [6 x i8] c"%02X-\00"
define i8* @UNSPEC_print(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @UNSPEC_print.buff, i64 0, i64 0), i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = icmp ult i64 %7, 4
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
%13 = load i8, i8* %11
%14 = zext i8 %13 to i32
%15 = and i32 %14, 255
%16 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 3
store i8* %18, i8** %3
br label %19
19: ; preds = %9
%20 = load i32, i32* %4
%21 = add i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 -1
store i8* %24, i8** %3
store i8 0, i8* %24
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @UNSPEC_print.buff, i64 0, i64 0)
}

LLVM IR (-O2):
@UNSPEC_print.buff = internal global [13 x i8] zeroinitializer
@.str = [6 x i8] c"%02X-\00"
define i8* @UNSPEC_print(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %0
%4 = zext i8 %3 to i32
%5 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @UNSPEC_print.buff, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @UNSPEC_print.buff, i64 0, i64 3), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i8, i8* %0, i64 3
%11 = load i8, i8* %6
%12 = zext i8 %11 to i32
%13 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @UNSPEC_print.buff, i64 0, i64 6), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i8, i8* %10
%15 = zext i8 %14 to i32
%16 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @UNSPEC_print.buff, i64 0, i64 9), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %15)
store i8 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @UNSPEC_print.buff, i64 0, i64 11)
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @UNSPEC_print.buff, i64 0, i64 0)
}