#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct sockaddr_un {
  char *sun_path;
};
struct TYPE_3__ {
  int /*<<< orphan*/ lower;
  int /*<<< orphan*/ type;
};
struct TYPE_4__ {
  TYPE_1__ nameseq;
};
struct sockaddr_tipc {
  TYPE_2__ addr;
};
struct sockaddr_storage {
  int ss_family;
};
struct sockaddr_in6 {
  int /*<<< orphan*/ sin6_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
};
typedef int /*<<< orphan*/ inet_buf;

/* Variables and functions */
#define AF_INET 131
#define AF_INET6 130
#define AF_TIPC 129
#define AF_UNIX 128
int INET6_ADDRSTRLEN;
char *inet_ntop(int, void *, char *, int);
int ntohl(int /*<<< orphan*/);
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
size_t snprintf(char *, size_t, char *, ...);
char *sock_log_saddr(struct sockaddr_storage *saddr, char *buf,
                     size_t buf_len) {
  int domain;
  union {
    struct sockaddr_un *sun;
    struct sockaddr_in *sin;
    struct sockaddr_in6 *sin6;
    struct sockaddr_storage *storage;
    struct sockaddr_tipc *stipc;
  } info;
  size_t n_used = 0;
  char inet_buf[INET6_ADDRSTRLEN];
  info.storage = saddr;
  domain = info.storage->ss_family;
  switch (domain) {
  case AF_UNIX:
    do {
      n_used +=
          snprintf(buf + n_used, buf_len - n_used, "%sUNIX %s",
                   (info.sun->sun_path[0] == '\0') ? "Abstract " : "",
                   (info.sun->sun_path[0] == '\0') ? info.sun->sun_path + 1
                                                   : info.sun->sun_path);
      if (n_used >= buf_len) {
        return buf;
      }
    } while (0);
    break;
  case AF_TIPC:
    do {
      n_used += snprintf(buf + n_used, buf_len - n_used,
                         "TIPC port_type %u instance %u",
                         ntohl(info.stipc->addr.nameseq.type),
                         ntohl(info.stipc->addr.nameseq.lower));
      if (n_used >= buf_len) {
        return buf;
      }
    } while (0);
    break;
  case AF_INET:
  case AF_INET6:
    do {
      n_used += snprintf(buf + n_used, buf_len - n_used, "IPv%d IP %s port %hu",
                         (domain == AF_INET) ? 4 : 6,
                         inet_ntop(domain,
                                   (domain == AF_INET)
                                       ? (void *)&info.sin->sin_addr
                                       : (void *)&info.sin6->sin6_addr,
                                   inet_buf, sizeof(inet_buf)),
                         ntohs(info.sin->sin_port));
      if (n_used >= buf_len) {
        return buf;
      }
    } while (0);
    break;
  default:
    do {
      n_used +=
          snprintf(buf + n_used, buf_len - n_used, "Unknown family %d", domain);
      if (n_used >= buf_len) {
        return buf;
      }
    } while (0);
    break;
  }
  return buf;
}


x86 assembly (clang, -O0):
<sock_log_saddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x38(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x60(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x50(%rbp)
sub    $0x80,%eax
je     11df <sock_log_saddr+0x9f>
jmp    11b6 <sock_log_saddr+0x76>
mov    -0x50(%rbp),%eax
sub    $0x81,%eax
je     12a8 <sock_log_saddr+0x168>
jmp    11c9 <sock_log_saddr+0x89>
mov    -0x50(%rbp),%eax
add    $0xffffff7e,%eax
sub    $0x2,%eax
jb     1346 <sock_log_saddr+0x206>
jmp    144a <sock_log_saddr+0x30a>
jmp    11e4 <sock_log_saddr+0xa4>
mov    -0x18(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x38(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edx
lea    0xe06(%rip),%rax
lea    0xdf6(%rip),%rcx
cmp    $0x0,%edx
cmove  %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1246 <sock_log_saddr+0x106>
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    1251 <sock_log_saddr+0x111>
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x68(%rbp),%rcx
mov    -0x70(%rbp),%rsi
mov    -0x78(%rbp),%rdi
mov    -0x80(%rbp),%r8
lea    0xd98(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jb     1299 <sock_log_saddr+0x159>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    14b8 <sock_log_saddr+0x378>
jmp    129e <sock_log_saddr+0x15e>
jmp    12a3 <sock_log_saddr+0x163>
jmp    14a9 <sock_log_saddr+0x369>
jmp    12ad <sock_log_saddr+0x16d>
mov    -0x18(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x38(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%edi
call   1060 <ntohl@plt>
mov    %eax,-0x84(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%edi
call   1060 <ntohl@plt>
mov    -0x98(%rbp),%rdi
mov    -0x90(%rbp),%rsi
mov    -0x84(%rbp),%ecx
mov    %eax,%r8d
lea    0xd0e(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jb     1337 <sock_log_saddr+0x1f7>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    14b8 <sock_log_saddr+0x378>
jmp    133c <sock_log_saddr+0x1fc>
jmp    1341 <sock_log_saddr+0x201>
jmp    14a9 <sock_log_saddr+0x369>
jmp    134b <sock_log_saddr+0x20b>
mov    -0x18(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x38(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x24(%rbp),%edx
mov    $0x6,%eax
mov    $0x4,%ecx
cmp    $0x83,%edx
cmove  %ecx,%eax
mov    %eax,-0xa0(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x9c(%rbp)
cmpl   $0x83,-0x24(%rbp)
jne    13ab <sock_log_saddr+0x26b>
mov    -0x30(%rbp),%rax
mov    %rax,-0xb8(%rbp)
jmp    13b6 <sock_log_saddr+0x276>
mov    -0x30(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x58(%rbp),%rdx
mov    -0x9c(%rbp),%edi
mov    -0x60(%rbp),%rax
mov    -0xb8(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,-0xc0(%rbp)
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%edi
call   1050 <ntohs@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xa8(%rbp),%rsi
mov    -0xa0(%rbp),%ecx
mov    -0xc0(%rbp),%r8
mov    %eax,%r9d
lea    0xc28(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jb     143b <sock_log_saddr+0x2fb>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    14b8 <sock_log_saddr+0x378>
jmp    1440 <sock_log_saddr+0x300>
jmp    1445 <sock_log_saddr+0x305>
jmp    14a9 <sock_log_saddr+0x369>
jmp    144f <sock_log_saddr+0x30f>
mov    -0x18(%rbp),%rdi
add    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
sub    -0x38(%rbp),%rsi
mov    -0x24(%rbp),%ecx
lea    0xbde(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jb     149a <sock_log_saddr+0x35a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    14b8 <sock_log_saddr+0x378>
jmp    149f <sock_log_saddr+0x35f>
jmp    14a4 <sock_log_saddr+0x364>
jmp    14a9 <sock_log_saddr+0x369>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_log_saddr>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    0x2e8a(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
lea    0xf(%rcx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdx
mov    %rdx,%rsp
mov    (%rdi),%eax
lea    -0x82(%rax),%esi
cmp    $0x2,%esi
jb     11cf <sock_log_saddr+0x8f>
cmp    $0x81,%eax
je     1213 <sock_log_saddr+0xd3>
cmp    $0x80,%eax
jne    1242 <sock_log_saddr+0x102>
mov    (%rbx),%rax
xor    %r8d,%r8d
cmpb   $0x0,(%rax)
sete   %r8b
lea    0xe62(%rip),%rdx
lea    0xe64(%rip),%rcx
cmove  %rdx,%rcx
add    %rax,%r8
lea    0xe43(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <snprintf@plt>
jmp    1258 <sock_log_saddr+0x118>
xor    %esi,%esi
cmp    $0x83,%eax
setne  %sil
lea    0x4(%rsi,%rsi,1),%r12d
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <inet_ntop@plt>
mov    %rax,%r13
mov    0x4(%rbx),%edi
call   1050 <ntohs@plt>
lea    0xe37(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12d,%ecx
mov    %r13,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <snprintf@plt>
jmp    1258 <sock_log_saddr+0x118>
mov    0x4(%rbx),%edi
call   1060 <ntohl@plt>
mov    %eax,%ebx
mov    $0x81,%edi
call   1060 <ntohl@plt>
lea    0xde6(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1040 <snprintf@plt>
jmp    1258 <sock_log_saddr+0x118>
lea    0xdfe(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    %r15,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_storage = type { i32 }
%union.anon = type { %struct.sockaddr_un* }
%struct.sockaddr_un = type { i8* }
%struct.sockaddr_tipc = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32, i32 }
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr_in6 = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@.str = [10 x i8] c"%sUNIX %s\00"
@.str.1 = [10 x i8] c"Abstract \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [30 x i8] c"TIPC port_type %u instance %u\00"
@.str.4 = [21 x i8] c"IPv%d IP %s port %hu\00"
@.str.5 = [18 x i8] c"Unknown family %d\00"
define i8* @sock_log_saddr(%struct.sockaddr_storage* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca %struct.sockaddr_storage*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca %union.anon
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i32
store %struct.sockaddr_storage* %0, %struct.sockaddr_storage** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 0, i64* %10
%14 = load i32, i32* @INET6_ADDRSTRLEN
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %11
%17 = alloca i8, i64 %15
store i64 %15, i64* %12
%18 = load %struct.sockaddr_storage*, %struct.sockaddr_storage** %5
%19 = bitcast %union.anon* %9 to %struct.sockaddr_storage**
store %struct.sockaddr_storage* %18, %struct.sockaddr_storage** %19
%20 = bitcast %union.anon* %9 to %struct.sockaddr_storage**
%21 = load %struct.sockaddr_storage*, %struct.sockaddr_storage** %20
%22 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %21, i32 0, i32 0
%23 = load i32, i32* %22
store i32 %23, i32* %8
%24 = load i32, i32* %8
switch i32 %24, label %153 [
i32 128, label %25
i32 129, label %75
i32 131, label %108
i32 130, label %108
]
25: ; preds = %3
br label %26
26: ; preds = %25
%27 = load i8*, i8** %6
%28 = load i64, i64* %10
%29 = getelementptr inbounds i8, i8* %27, i64 %28
%30 = load i64, i64* %7
%31 = load i64, i64* %10
%32 = sub i64 %30, %31
%33 = bitcast %union.anon* %9 to %struct.sockaddr_un**
%34 = load %struct.sockaddr_un*, %struct.sockaddr_un** %33
%35 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %34, i32 0, i32 0
%36 = load i8*, i8** %35
%37 = getelementptr inbounds i8, i8* %36, i64 0
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 0
%41 = zext i1 %40 to i64
%42 = select i1 %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%43 = bitcast %union.anon* %9 to %struct.sockaddr_un**
%44 = load %struct.sockaddr_un*, %struct.sockaddr_un** %43
%45 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %44, i32 0, i32 0
%46 = load i8*, i8** %45
%47 = getelementptr inbounds i8, i8* %46, i64 0
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %57
51: ; preds = %26
%52 = bitcast %union.anon* %9 to %struct.sockaddr_un**
%53 = load %struct.sockaddr_un*, %struct.sockaddr_un** %52
%54 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %53, i32 0, i32 0
%55 = load i8*, i8** %54
%56 = getelementptr inbounds i8, i8* %55, i64 1
br label %62
57: ; preds = %26
%58 = bitcast %union.anon* %9 to %struct.sockaddr_un**
%59 = load %struct.sockaddr_un*, %struct.sockaddr_un** %58
%60 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %59, i32 0, i32 0
%61 = load i8*, i8** %60
br label %62
62: ; preds = %57, %51
%63 = phi i8* [ %56, %51 ], [ %61, %57 ]
%64 = call i64 (i8*, i64, i8*, ...) @snprintf(i8* %29, i64 %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %42, i8* %63)
%65 = load i64, i64* %10
%66 = add i64 %65, %64
store i64 %66, i64* %10
%67 = load i64, i64* %10
%68 = load i64, i64* %7
%69 = icmp uge i64 %67, %68
br i1 %69, label %70, label %72
70: ; preds = %62
%71 = load i8*, i8** %6
store i8* %71, i8** %4
store i32 1, i32* %13
br label %175
72: ; preds = %62
br label %73
73: ; preds = %72
br label %74
74: ; preds = %73
br label %173
75: ; preds = %3
br label %76
76: ; preds = %75
%77 = load i8*, i8** %6
%78 = load i64, i64* %10
%79 = getelementptr inbounds i8, i8* %77, i64 %78
%80 = load i64, i64* %7
%81 = load i64, i64* %10
%82 = sub i64 %80, %81
%83 = bitcast %union.anon* %9 to %struct.sockaddr_tipc**
%84 = load %struct.sockaddr_tipc*, %struct.sockaddr_tipc** %83
%85 = getelementptr inbounds %struct.sockaddr_tipc, %struct.sockaddr_tipc* %84, i32 0, i32 0
%86 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %85, i32 0, i32 0
%87 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %86, i32 0, i32 1
%88 = load i32, i32* %87
%89 = call i32 @ntohl(i32 %88)
%90 = bitcast %union.anon* %9 to %struct.sockaddr_tipc**
%91 = load %struct.sockaddr_tipc*, %struct.sockaddr_tipc** %90
%92 = getelementptr inbounds %struct.sockaddr_tipc, %struct.sockaddr_tipc* %91, i32 0, i32 0
%93 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %92, i32 0, i32 0
%94 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %93, i32 0, i32 0
%95 = load i32, i32* %94
%96 = call i32 @ntohl(i32 %95)
%97 = call i64 (i8*, i64, i8*, ...) @snprintf(i8* %79, i64 %82, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %89, i32 %96)
%98 = load i64, i64* %10
%99 = add i64 %98, %97
store i64 %99, i64* %10
%100 = load i64, i64* %10
%101 = load i64, i64* %7
%102 = icmp uge i64 %100, %101
br i1 %102, label %103, label %105
103: ; preds = %76
%104 = load i8*, i8** %6
store i8* %104, i8** %4
store i32 1, i32* %13
br label %175
105: ; preds = %76
br label %106
106: ; preds = %105
br label %107
107: ; preds = %106
br label %173
108: ; preds = %3, %3
br label %109
109: ; preds = %108
%110 = load i8*, i8** %6
%111 = load i64, i64* %10
%112 = getelementptr inbounds i8, i8* %110, i64 %111
%113 = load i64, i64* %7
%114 = load i64, i64* %10
%115 = sub i64 %113, %114
%116 = load i32, i32* %8
%117 = icmp eq i32 %116, 131
%118 = zext i1 %117 to i64
%119 = select i1 %117, i32 4, i32 6
%120 = load i32, i32* %8
%121 = load i32, i32* %8
%122 = icmp eq i32 %121, 131
br i1 %122, label %123, label %128
123: ; preds = %109
%124 = bitcast %union.anon* %9 to %struct.sockaddr_in**
%125 = load %struct.sockaddr_in*, %struct.sockaddr_in** %124
%126 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %125, i32 0, i32 0
%127 = bitcast i32* %126 to i8*
br label %133
128: ; preds = %109
%129 = bitcast %union.anon* %9 to %struct.sockaddr_in6**
%130 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %129
%131 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %130, i32 0, i32 0
%132 = bitcast i32* %131 to i8*
br label %133
133: ; preds = %128, %123
%134 = phi i8* [ %127, %123 ], [ %132, %128 ]
%135 = trunc i64 %15 to i32
%136 = call i8* @inet_ntop(i32 %120, i8* %134, i8* %17, i32 %135)
%137 = bitcast %union.anon* %9 to %struct.sockaddr_in**
%138 = load %struct.sockaddr_in*, %struct.sockaddr_in** %137
%139 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %138, i32 0, i32 1
%140 = load i32, i32* %139
%141 = call i32 @ntohs(i32 %140)
%142 = call i64 (i8*, i64, i8*, ...) @snprintf(i8* %112, i64 %115, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %119, i8* %136, i32 %141)
%143 = load i64, i64* %10
%144 = add i64 %143, %142
store i64 %144, i64* %10
%145 = load i64, i64* %10
%146 = load i64, i64* %7
%147 = icmp uge i64 %145, %146
br i1 %147, label %148, label %150
148: ; preds = %133
%149 = load i8*, i8** %6
store i8* %149, i8** %4
store i32 1, i32* %13
br label %175
150: ; preds = %133
br label %151
151: ; preds = %150
br label %152
152: ; preds = %151
br label %173
153: ; preds = %3
br label %154
154: ; preds = %153
%155 = load i8*, i8** %6
%156 = load i64, i64* %10
%157 = getelementptr inbounds i8, i8* %155, i64 %156
%158 = load i64, i64* %7
%159 = load i64, i64* %10
%160 = sub i64 %158, %159
%161 = load i32, i32* %8
%162 = call i64 (i8*, i64, i8*, ...) @snprintf(i8* %157, i64 %160, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %161)
%163 = load i64, i64* %10
%164 = add i64 %163, %162
store i64 %164, i64* %10
%165 = load i64, i64* %10
%166 = load i64, i64* %7
%167 = icmp uge i64 %165, %166
br i1 %167, label %168, label %170
168: ; preds = %154
%169 = load i8*, i8** %6
store i8* %169, i8** %4
store i32 1, i32* %13
br label %175
170: ; preds = %154
br label %171
171: ; preds = %170
br label %172
172: ; preds = %171
br label %173
173: ; preds = %172, %152, %107, %74
%174 = load i8*, i8** %6
store i8* %174, i8** %4
store i32 1, i32* %13
br label %175
175: ; preds = %173, %168, %148, %103, %70
%176 = load i8*, i8** %11
%177 = load i8*, i8** %4
ret i8* %177
}

LLVM IR (-O2):
%struct.sockaddr_storage = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@.str = [10 x i8] c"%sUNIX %s\00"
@.str.1 = [10 x i8] c"Abstract \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [30 x i8] c"TIPC port_type %u instance %u\00"
@.str.4 = [21 x i8] c"IPv%d IP %s port %hu\00"
@.str.5 = [18 x i8] c"Unknown family %d\00"
define i8* @sock_log_saddr(%struct.sockaddr_storage* %0, i8* returned %1, i64 %2) {
%4 = load i32, i32* @INET6_ADDRSTRLEN
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %0, i64 0, i32 0
%8 = load i32, i32* %7
switch i32 %8, label %33 [
i32 128, label %9
i32 129, label %18
i32 131, label %24
i32 130, label %24
]
9: ; preds = %3
%10 = bitcast %struct.sockaddr_storage* %0 to i8**
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%15 = zext i1 %13 to i64
%16 = getelementptr i8, i8* %11, i64 %15
%17 = tail call i64 (i8*, i64, i8*, ...) @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %16)
br label %35
18: ; preds = %3
%19 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %0, i64 1, i32 0
%20 = load i32, i32* %19
%21 = tail call i32 @ntohl(i32 %20)
%22 = tail call i32 @ntohl(i32 129)
%23 = tail call i64 (i8*, i64, i8*, ...) @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %22)
br label %35
24: ; preds = %3, %3
%25 = icmp eq i32 %8, 131
%26 = select i1 %25, i32 4, i32 6
%27 = bitcast %struct.sockaddr_storage* %0 to i8*
%28 = call i8* @inet_ntop(i32 %8, i8* %27, i8* %6, i32 %4)
%29 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %0, i64 1, i32 0
%30 = load i32, i32* %29
%31 = call i32 @ntohs(i32 %30)
%32 = call i64 (i8*, i64, i8*, ...) @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %26, i8* %28, i32 %31)
br label %35
33: ; preds = %3
%34 = tail call i64 (i8*, i64, i8*, ...) @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %8)
br label %35
35: ; preds = %33, %24, %18, %9
ret i8* %1
}