#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_storage {
  int dummy;
};
struct sockaddr_in6 {
  int /*<<< orphan*/ sin6_addr;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
int /*<<< orphan*/ assert_string(char *, char *, char *);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/ *, char *,
                             int);
void assert_ip6(char *expected, struct sockaddr_storage *reality, char *msg) {
  char dst[255];
  inet_ntop(AF_INET6, &((struct sockaddr_in6 *)reality)->sin6_addr, &dst[0],
            255);
  assert_string(expected, dst, msg);
}


x86 assembly (clang, -O0):
<assert_ip6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
lea    -0x120(%rbp),%rdx
mov    $0xff,%ecx
call   1030 <inet_ntop@plt>
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <assert_string@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_ip6>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rdx,%r14
mov    %rdi,%rbx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%r15
mov    %r15,%rdx
mov    $0xff,%ecx
call   1030 <inet_ntop@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <assert_string@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr_in6 = type { i32 }
@AF_INET6 = global i32 0
define void @assert_ip6(i8* %0, %struct.sockaddr_storage* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca %struct.sockaddr_storage*
%6 = alloca i8*
%7 = alloca [255 x i8]
store i8* %0, i8** %4
store %struct.sockaddr_storage* %1, %struct.sockaddr_storage** %5
store i8* %2, i8** %6
%8 = load i32, i32* @AF_INET6
%9 = load %struct.sockaddr_storage*, %struct.sockaddr_storage** %5
%10 = bitcast %struct.sockaddr_storage* %9 to %struct.sockaddr_in6*
%11 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %10, i32 0, i32 0
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%13 = call i32 @inet_ntop(i32 %8, i32* %11, i8* %12, i32 255)
%14 = load i8*, i8** %4
%15 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%16 = load i8*, i8** %6
%17 = call i32 @assert_string(i8* %14, i8* %15, i8* %16)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_storage = type { i32 }
@AF_INET6 = global i32 0
define void @assert_ip6(i8* %0, %struct.sockaddr_storage* %1, i8* %2) {
%4 = alloca [255 x i8]
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%6 = load i32, i32* @AF_INET6
%7 = getelementptr %struct.sockaddr_storage, %struct.sockaddr_storage* %1, i64 0, i32 0
%8 = call i32 @inet_ntop(i32 %6, i32* %7, i8* %5, i32 255)
%9 = call i32 @assert_string(i8* %0, i8* %5, i8* %2)
ret void
}