#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_in {
  scalar_t__ sin_family;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
scalar_t__ AF_INET;
int /*<<< orphan*/ Tvbf(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ inet_ntoa(int /*<<< orphan*/);
void Tvbaddr(const struct sockaddr *addr, int len) {
  const struct sockaddr_in *ai = (const struct sockaddr_in *)addr;
  assert(len == sizeof(struct sockaddr_in));
  assert(ai->sin_family == AF_INET);
  Tvbf("%s:%u", inet_ntoa(ai->sin_addr), htons(ai->sin_port));
}


x86 assembly (clang, -O0):
<Tvbaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x10,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2e6e(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
call   1040 <htons@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe4f(%rip),%rdi
call   1060 <Tvbf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Tvbaddr>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x10,%esi
sete   %dil
call   1050 <assert@plt>
mov    (%rbx),%rax
mov    0x2e8a(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1050 <assert@plt>
mov    0xc(%rbx),%edi
call   1030 <inet_ntoa@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%edi
call   1040 <htons@plt>
lea    0xe7b(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <Tvbf@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.sockaddr_in = type { i64, i32, i32 }
@AF_INET = global i64 0
@.str = [6 x i8] c"%s:%u\00"
define void @Tvbaddr(%struct.sockaddr* %0, i32 %1) {
%3 = alloca %struct.sockaddr*
%4 = alloca i32
%5 = alloca %struct.sockaddr_in*
store %struct.sockaddr* %0, %struct.sockaddr** %3
store i32 %1, i32* %4
%6 = load %struct.sockaddr*, %struct.sockaddr** %3
%7 = bitcast %struct.sockaddr* %6 to %struct.sockaddr_in*
store %struct.sockaddr_in* %7, %struct.sockaddr_in** %5
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = icmp eq i64 %9, 16
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = load i64, i64* @AF_INET
%17 = icmp eq i64 %15, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i32 0, i32 2
%22 = load i32, i32* %21
%23 = call i32 @inet_ntoa(i32 %22)
%24 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %24, i32 0, i32 1
%26 = load i32, i32* %25
%27 = call i32 @htons(i32 %26)
%28 = call i32 @Tvbf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %27)
ret void
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@AF_INET = global i64 0
@.str = [6 x i8] c"%s:%u\00"
define void @Tvbaddr(%struct.sockaddr* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 16
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = bitcast %struct.sockaddr* %0 to i64*
%7 = load i64, i64* %6
%8 = load i64, i64* @AF_INET
%9 = icmp eq i64 %7, %8
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %0, i64 3, i32 0
%13 = load i32, i32* %12
%14 = tail call i32 @inet_ntoa(i32 %13)
%15 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %0, i64 2, i32 0
%16 = load i32, i32* %15
%17 = tail call i32 @htons(i32 %16)
%18 = tail call i32 @Tvbf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %17)
ret void
}