#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_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ *s6_addr;
};
struct sockaddr_in6 {
  TYPE_1__ sin6_addr;
};

/* Variables and functions */
char *allocateString(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/, int /*<<< orphan*/);
char *ipv6ToString(const struct sockaddr_in6 *address) {
  return allocateString(
      "%02x%02x:%02x%02x:%02x%02x:%02x%02x:"
      "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
      address->sin6_addr.s6_addr[0], address->sin6_addr.s6_addr[1],
      address->sin6_addr.s6_addr[2], address->sin6_addr.s6_addr[3],
      address->sin6_addr.s6_addr[4], address->sin6_addr.s6_addr[5],
      address->sin6_addr.s6_addr[6], address->sin6_addr.s6_addr[7],
      address->sin6_addr.s6_addr[8], address->sin6_addr.s6_addr[9],
      address->sin6_addr.s6_addr[10], address->sin6_addr.s6_addr[11],
      address->sin6_addr.s6_addr[12], address->sin6_addr.s6_addr[13],
      address->sin6_addr.s6_addr[14], address->sin6_addr.s6_addr[15]);
}


x86 assembly (clang, -O0):
<ipv6ToString>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdi,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    0x4(%rax),%edx
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%ecx
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    0xc(%rax),%r8d
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    0x10(%rax),%r9d
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    0x14(%rax),%eax
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x18(%rdi),%edi
mov    %edi,-0x3c(%rbp)
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x1c(%rdi),%edi
mov    %edi,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x20(%rdi),%r13d
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x24(%rdi),%r12d
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x28(%rdi),%r15d
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x2c(%rdi),%r14d
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x30(%rdi),%ebx
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x34(%rdi),%r11d
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x38(%rdi),%r10d
mov    -0x30(%rbp),%rdi
mov    (%rdi),%rdi
mov    0x3c(%rdi),%edi
mov    %edi,-0x34(%rbp)
lea    0xe24(%rip),%rdi
mov    %eax,(%rsp)
mov    -0x3c(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x38(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0x34(%rbp),%eax
mov    %r13d,0x18(%rsp)
mov    %r12d,0x20(%rsp)
mov    %r15d,0x28(%rsp)
mov    %r14d,0x30(%rsp)
mov    %ebx,0x38(%rsp)
mov    %r11d,0x40(%rsp)
mov    %r10d,0x48(%rsp)
mov    %eax,0x50(%rsp)
call   1030 <allocateString@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipv6ToString>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    (%rdi),%rdi
mov    (%rdi),%esi
mov    0x4(%rdi),%edx
mov    0x8(%rdi),%ecx
mov    0xc(%rdi),%r8d
mov    0x10(%rdi),%r9d
mov    0x14(%rdi),%eax
mov    %rax,0x10(%rsp)
mov    0x18(%rdi),%eax
mov    %rax,0x8(%rsp)
mov    0x1c(%rdi),%r14d
mov    0x20(%rdi),%r15d
mov    0x24(%rdi),%r12d
mov    0x28(%rdi),%r13d
mov    0x2c(%rdi),%r11d
mov    0x30(%rdi),%ebx
mov    0x34(%rdi),%ebp
mov    0x38(%rdi),%r10d
mov    0x3c(%rdi),%eax
sub    $0x8,%rsp
lea    0xe93(%rip),%rdi
push   %rax
push   %r10
push   %rbp
push   %rbx
push   %r11
push   %r13
push   %r12
push   %r15
push   %r14
push   0x58(%rsp)
push   0x68(%rsp)
call   1030 <allocateString@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in6 = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32* }
@.str = [72 x i8] c"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\00"
define i8* @ipv6ToString(%struct.sockaddr_in6* %0) {
%2 = alloca %struct.sockaddr_in6*
store %struct.sockaddr_in6* %0, %struct.sockaddr_in6** %2
%3 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%4 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %3, i32 0, i32 0
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i32*, i32** %5
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%10 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %9, i32 0, i32 0
%11 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %10, i32 0, i32 0
%12 = load i32*, i32** %11
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%16 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %15, i32 0, i32 0
%17 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %16, i32 0, i32 0
%18 = load i32*, i32** %17
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%22 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %21, i32 0, i32 0
%23 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %22, i32 0, i32 0
%24 = load i32*, i32** %23
%25 = getelementptr inbounds i32, i32* %24, i64 3
%26 = load i32, i32* %25
%27 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%28 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %27, i32 0, i32 0
%29 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %28, i32 0, i32 0
%30 = load i32*, i32** %29
%31 = getelementptr inbounds i32, i32* %30, i64 4
%32 = load i32, i32* %31
%33 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%34 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %33, i32 0, i32 0
%35 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %34, i32 0, i32 0
%36 = load i32*, i32** %35
%37 = getelementptr inbounds i32, i32* %36, i64 5
%38 = load i32, i32* %37
%39 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%40 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %39, i32 0, i32 0
%41 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %40, i32 0, i32 0
%42 = load i32*, i32** %41
%43 = getelementptr inbounds i32, i32* %42, i64 6
%44 = load i32, i32* %43
%45 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%46 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %45, i32 0, i32 0
%47 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %46, i32 0, i32 0
%48 = load i32*, i32** %47
%49 = getelementptr inbounds i32, i32* %48, i64 7
%50 = load i32, i32* %49
%51 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%52 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %51, i32 0, i32 0
%53 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %52, i32 0, i32 0
%54 = load i32*, i32** %53
%55 = getelementptr inbounds i32, i32* %54, i64 8
%56 = load i32, i32* %55
%57 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%58 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %57, i32 0, i32 0
%59 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %58, i32 0, i32 0
%60 = load i32*, i32** %59
%61 = getelementptr inbounds i32, i32* %60, i64 9
%62 = load i32, i32* %61
%63 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%64 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %63, i32 0, i32 0
%65 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %64, i32 0, i32 0
%66 = load i32*, i32** %65
%67 = getelementptr inbounds i32, i32* %66, i64 10
%68 = load i32, i32* %67
%69 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%70 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %69, i32 0, i32 0
%71 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %70, i32 0, i32 0
%72 = load i32*, i32** %71
%73 = getelementptr inbounds i32, i32* %72, i64 11
%74 = load i32, i32* %73
%75 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%76 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %75, i32 0, i32 0
%77 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %76, i32 0, i32 0
%78 = load i32*, i32** %77
%79 = getelementptr inbounds i32, i32* %78, i64 12
%80 = load i32, i32* %79
%81 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%82 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %81, i32 0, i32 0
%83 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %82, i32 0, i32 0
%84 = load i32*, i32** %83
%85 = getelementptr inbounds i32, i32* %84, i64 13
%86 = load i32, i32* %85
%87 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%88 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %87, i32 0, i32 0
%89 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %88, i32 0, i32 0
%90 = load i32*, i32** %89
%91 = getelementptr inbounds i32, i32* %90, i64 14
%92 = load i32, i32* %91
%93 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %2
%94 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %93, i32 0, i32 0
%95 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %94, i32 0, i32 0
%96 = load i32*, i32** %95
%97 = getelementptr inbounds i32, i32* %96, i64 15
%98 = load i32, i32* %97
%99 = call i8* @allocateString(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %14, i32 %20, i32 %26, i32 %32, i32 %38, i32 %44, i32 %50, i32 %56, i32 %62, i32 %68, i32 %74, i32 %80, i32 %86, i32 %92, i32 %98)
ret i8* %99
}

LLVM IR (-O2):
%struct.sockaddr_in6 = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32* }
@.str = [72 x i8] c"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\00"
define i8* @ipv6ToString(%struct.sockaddr_in6* nocapture %0) {
%2 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %0, i64 0, i32 0, i32 0
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = getelementptr inbounds i32, i32* %3, i64 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds i32, i32* %3, i64 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %3, i64 3
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %3, i64 4
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %3, i64 5
%14 = load i32, i32* %13
%15 = getelementptr inbounds i32, i32* %3, i64 6
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %3, i64 7
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %3, i64 8
%20 = load i32, i32* %19
%21 = getelementptr inbounds i32, i32* %3, i64 9
%22 = load i32, i32* %21
%23 = getelementptr inbounds i32, i32* %3, i64 10
%24 = load i32, i32* %23
%25 = getelementptr inbounds i32, i32* %3, i64 11
%26 = load i32, i32* %25
%27 = getelementptr inbounds i32, i32* %3, i64 12
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %3, i64 13
%30 = load i32, i32* %29
%31 = getelementptr inbounds i32, i32* %3, i64 14
%32 = load i32, i32* %31
%33 = getelementptr inbounds i32, i32* %3, i64 15
%34 = load i32, i32* %33
%35 = tail call i8* @allocateString(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, i32 %26, i32 %28, i32 %30, i32 %32, i32 %34)
ret i8* %35
}