#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 sa_family;
  int /*<<< orphan*/ sa_data;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
char *UNSPEC_print(int /*<<< orphan*/);
char *safe_strncpy(char *, char *, int);
char *UNSPEC_sprint(struct sockaddr *sap, int numeric) {
  static char buf[64];
  if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
    return safe_strncpy(buf, "[NONE SET]", sizeof(buf));
  return (UNSPEC_print(sap->sa_data));
}


x86 assembly (clang, -O0):
<UNSPEC_sprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0xffff,(%rax)
je     114c <UNSPEC_sprint+0x2c>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    116d <UNSPEC_sprint+0x4d>
lea    0x2eed(%rip),%rdi
lea    0xea6(%rip),%rsi
mov    $0x40,%edx
call   1030 <safe_strncpy@plt>
mov    %rax,-0x8(%rbp)
jmp    117d <UNSPEC_sprint+0x5d>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <UNSPEC_print@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UNSPEC_sprint>:
mov    (%rdi),%eax
cmp    $0xffff,%eax
je     112d <UNSPEC_sprint+0xd>
test   %eax,%eax
jne    1145 <UNSPEC_sprint+0x25>
lea    0x2f0c(%rip),%rdi
lea    0xec5(%rip),%rsi
mov    $0x40,%edx
jmp    1030 <safe_strncpy@plt>
mov    0x4(%rdi),%edi
jmp    1040 <UNSPEC_print@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32, i32 }
@UNSPEC_sprint.buf = internal global [64 x i8] zeroinitializer
@.str = [11 x i8] c"[NONE SET]\00"
define i8* @UNSPEC_sprint(%struct.sockaddr* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca %struct.sockaddr*
%5 = alloca i32
store %struct.sockaddr* %0, %struct.sockaddr** %4
store i32 %1, i32* %5
%6 = load %struct.sockaddr*, %struct.sockaddr** %4
%7 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 65535
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load %struct.sockaddr*, %struct.sockaddr** %4
%12 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10, %2
%16 = call i8* @safe_strncpy(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @UNSPEC_sprint.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 64)
store i8* %16, i8** %3
br label %22
17: ; preds = %10
%18 = load %struct.sockaddr*, %struct.sockaddr** %4
%19 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %18, i32 0, i32 1
%20 = load i32, i32* %19
%21 = call i8* @UNSPEC_print(i32 %20)
store i8* %21, i8** %3
br label %22
22: ; preds = %17, %15
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
%struct.sockaddr = type { i32, i32 }
@UNSPEC_sprint.buf = internal global [64 x i8] zeroinitializer
@.str = [11 x i8] c"[NONE SET]\00"
define i8* @UNSPEC_sprint(%struct.sockaddr* nocapture %0, i32 %1) {
%3 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %0, i64 0, i32 0
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 65535, label %5
i32 0, label %5
]
5: ; preds = %2, %2
%6 = tail call i8* @safe_strncpy(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @UNSPEC_sprint.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 64)
br label %11
7: ; preds = %2
%8 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %0, i64 0, i32 1
%9 = load i32, i32* %8
%10 = tail call i8* @UNSPEC_print(i32 %9)
br label %11
11: ; preds = %7, %5
%12 = phi i8* [ %6, %5 ], [ %10, %7 ]
ret i8* %12
}