#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char, unsigned char);
int show_address(unsigned char *ipv6_address) {
  int count = 7;
  while (count > 0) {
    printf("%02x%02x:", ipv6_address[0], ipv6_address[1]);
    ipv6_address += 2;
    count--;
  }
  printf("%02x%02x\n", ipv6_address[0], ipv6_address[1]);
  return 0;
}


x86 assembly (clang, -O0):
<show_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x7,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1164 <show_address+0x54>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
lea    0xec2(%rip),%rdi
movzbl %cl,%esi
movzbl 0x1(%rax),%edx
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <show_address+0x13>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
lea    0xe95(%rip),%rdi
movzbl %cl,%esi
movzbl 0x1(%rax),%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_address>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movzbl (%rdi),%esi
movzbl 0x1(%rdi),%edx
lea    0xedb(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x2(%rbx),%esi
movzbl 0x3(%rbx),%edx
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x4(%rbx),%esi
movzbl 0x5(%rbx),%edx
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x6(%rbx),%esi
movzbl 0x7(%rbx),%edx
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x8(%rbx),%esi
movzbl 0x9(%rbx),%edx
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0xa(%rbx),%esi
movzbl 0xb(%rbx),%edx
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0xc(%rbx),%esi
movzbl 0xd(%rbx),%edx
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0xe(%rbx),%esi
movzbl 0xf(%rbx),%edx
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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