#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 in6_addr {
  int *s6_addr;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int, int);
void _inet6_print_addr(struct in6_addr *addr) {
  size_t i;
  char const *sep = "";
  for (i = 0; i < 16; i += 2) {
    printf("%s%02x%02x", sep, addr->s6_addr[i], addr->s6_addr[i + 1]);
    sep = ":";
  }
}


x86 assembly (clang, -O0):
<_inet6_print_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xee9(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x10,-0x10(%rbp)
jae    1183 <_inet6_print_addr+0x73>
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    0x4(%rax,%rcx,4),%ecx
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    112f <_inet6_print_addr+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_inet6_print_addr>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    (%rax),%edx
mov    0x4(%rax),%ecx
lea    0xed9(%rip),%r14
lea    0xede(%rip),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    0x8(%rax),%edx
mov    0xc(%rax),%ecx
lea    0xec5(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    0x10(%rax),%edx
mov    0x14(%rax),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    0x18(%rax),%edx
mov    0x1c(%rax),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    0x20(%rax),%edx
mov    0x24(%rax),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    0x28(%rax),%edx
mov    0x2c(%rax),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    0x30(%rax),%edx
mov    0x34(%rax),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    0x38(%rax),%edx
mov    0x3c(%rax),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.in6_addr = type { i32* }
@.str = [1 x i8] zeroinitializer
@.str.1 = [11 x i8] c"%s%02x%02x\00"
@.str.2 = [2 x i8] c":\00"
define void @_inet6_print_addr(%struct.in6_addr* %0) {
%2 = alloca %struct.in6_addr*
%3 = alloca i64
%4 = alloca i8*
store %struct.in6_addr* %0, %struct.in6_addr** %2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %4
store i64 0, i64* %3
br label %5
5: ; preds = %24, %1
%6 = load i64, i64* %3
%7 = icmp ult i64 %6, 16
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = load i8*, i8** %4
%10 = load %struct.in6_addr*, %struct.in6_addr** %2
%11 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %10, i32 0, i32 0
%12 = load i32*, i32** %11
%13 = load i64, i64* %3
%14 = getelementptr inbounds i32, i32* %12, i64 %13
%15 = load i32, i32* %14
%16 = load %struct.in6_addr*, %struct.in6_addr** %2
%17 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %16, i32 0, i32 0
%18 = load i32*, i32** %17
%19 = load i64, i64* %3
%20 = add i64 %19, 1
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %15, i32 %22)
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %4
br label %24
24: ; preds = %8
%25 = load i64, i64* %3
%26 = add i64 %25, 2
store i64 %26, i64* %3
br label %5
27: ; preds = %5
ret void
}

LLVM IR (-O2):
%struct.in6_addr = type { i32* }
@.str = [1 x i8] zeroinitializer
@.str.1 = [11 x i8] c"%s%02x%02x\00"
@.str.2 = [2 x i8] c":\00"
define void @_inet6_print_addr(%struct.in6_addr* nocapture %0) {
%2 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %0, i64 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 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6)
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 2
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %8, i64 3
%12 = load i32, i32* %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %12)
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 4
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %14, i64 5
%18 = load i32, i32* %17
%19 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %18)
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 6
%22 = load i32, i32* %21
%23 = getelementptr inbounds i32, i32* %20, i64 7
%24 = load i32, i32* %23
%25 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %24)
%26 = load i32*, i32** %2
%27 = getelementptr inbounds i32, i32* %26, i64 8
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %26, i64 9
%30 = load i32, i32* %29
%31 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %30)
%32 = load i32*, i32** %2
%33 = getelementptr inbounds i32, i32* %32, i64 10
%34 = load i32, i32* %33
%35 = getelementptr inbounds i32, i32* %32, i64 11
%36 = load i32, i32* %35
%37 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %34, i32 %36)
%38 = load i32*, i32** %2
%39 = getelementptr inbounds i32, i32* %38, i64 12
%40 = load i32, i32* %39
%41 = getelementptr inbounds i32, i32* %38, i64 13
%42 = load i32, i32* %41
%43 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %40, i32 %42)
%44 = load i32*, i32** %2
%45 = getelementptr inbounds i32, i32* %44, i64 14
%46 = load i32, i32* %45
%47 = getelementptr inbounds i32, i32* %44, i64 15
%48 = load i32, i32* %47
%49 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %46, i32 %48)
ret void
}