#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 ether_addr {
  int dummy;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned char, unsigned char,
                            unsigned char, unsigned char, unsigned char,
                            unsigned char);
char *Ether_Ntoa(struct ether_addr *e) {
  unsigned char *pe;
  static char buf[30];
  pe = (unsigned char *)e;
  snprintf(buf, sizeof(buf), "%02x:%02x:%02x:%02x:%02x:%02x", pe[0], pe[1],
           pe[2], pe[3], pe[4], pe[5]);
  return (buf);
}


x86 assembly (clang, -O0):
<Ether_Ntoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%r8b
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%r9b
mov    -0x10(%rbp),%rax
mov    0x3(%rax),%r11b
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%r10b
mov    -0x10(%rbp),%rax
lea    0x2eeb(%rip),%rdi
mov    $0x1e,%esi
lea    0xe9f(%rip),%rdx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl %r11b,%r11d
mov    %r11d,(%rsp)
movzbl %r10b,%r10d
mov    %r10d,0x8(%rsp)
movzbl 0x5(%rax),%eax
mov    %eax,0x10(%rsp)
call   1030 <snprintf@plt>
lea    0x2eaf(%rip),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ether_Ntoa>:
push   %r14
push   %rbx
push   %rax
movzbl (%rdi),%ecx
movzbl 0x1(%rdi),%r8d
movzbl 0x2(%rdi),%r9d
movzbl 0x3(%rdi),%r10d
movzbl 0x4(%rdi),%ebx
movzbl 0x5(%rdi),%eax
sub    $0x8,%rsp
lea    0x2f07(%rip),%r14
lea    0xec0(%rip),%rdx
mov    %r14,%rdi
mov    $0x1e,%esi
push   %rax
push   %rbx
push   %r10
call   1030 <snprintf@plt>
add    $0x20,%rsp
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ether_addr = type { i32 }
@Ether_Ntoa.buf = internal global [30 x i8] zeroinitializer
@.str = [30 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\00"
define i8* @Ether_Ntoa(%struct.ether_addr* %0) {
%2 = alloca %struct.ether_addr*
%3 = alloca i8*
store %struct.ether_addr* %0, %struct.ether_addr** %2
%4 = load %struct.ether_addr*, %struct.ether_addr** %2
%5 = bitcast %struct.ether_addr* %4 to i8*
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 2
%14 = load i8, i8* %13
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 3
%17 = load i8, i8* %16
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 4
%20 = load i8, i8* %19
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 5
%23 = load i8, i8* %22
%24 = call i32 @snprintf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @Ether_Ntoa.buf, i64 0, i64 0), i32 30, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 zeroext %8, i8 zeroext %11, i8 zeroext %14, i8 zeroext %17, i8 zeroext %20, i8 zeroext %23)
ret i8* getelementptr inbounds ([30 x i8], [30 x i8]* @Ether_Ntoa.buf, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.ether_addr = type { i32 }
@Ether_Ntoa.buf = internal global [30 x i8] zeroinitializer
@.str = [30 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\00"
define i8* @Ether_Ntoa(%struct.ether_addr* nocapture %0) {
%2 = bitcast %struct.ether_addr* %0 to i8*
%3 = load i8, i8* %2
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8, i8* %2, i64 2
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %2, i64 3
%9 = load i8, i8* %8
%10 = getelementptr inbounds %struct.ether_addr, %struct.ether_addr* %0, i64 1
%11 = bitcast %struct.ether_addr* %10 to i8*
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %2, i64 5
%14 = load i8, i8* %13
%15 = tail call i32 @snprintf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @Ether_Ntoa.buf, i64 0, i64 0), i32 30, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 zeroext %3, i8 zeroext %5, i8 zeroext %7, i8 zeroext %9, i8 zeroext %12, i8 zeroext %14)
ret i8* getelementptr inbounds ([30 x i8], [30 x i8]* @Ether_Ntoa.buf, i64 0, i64 0)
}