#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 *, ...);
void PrintMac(char *mac_str) {
  int i = 0;
  for (i = 0; i < 12; i++) {
    printf("%c", mac_str[i]);
    if (((i + 1) % 2 == 0) && (i != 11)) {
      printf(":");
    }
  }
}


x86 assembly (clang, -O0):
<PrintMac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xc,-0xc(%rbp)
jge    1190 <PrintMac+0x80>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117d <PrintMac+0x6d>
cmpl   $0xb,-0xc(%rbp)
je     117d <PrintMac+0x6d>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1182 <PrintMac+0x72>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <PrintMac+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintMac>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <putchar@plt>
movsbl 0x1(%rbx),%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
movsbl 0x2(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x3(%rbx),%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
movsbl 0x4(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x5(%rbx),%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
movsbl 0x6(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x7(%rbx),%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
movsbl 0x8(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x9(%rbx),%edi
call   1030 <putchar@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
movsbl 0xa(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0xb(%rbx),%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @PrintMac(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = tail call i32 @putchar(i32 %3)
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = tail call i32 @putchar(i32 %7)
%9 = tail call i32 @putchar(i32 58)
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = tail call i32 @putchar(i32 %12)
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i32 @putchar(i32 %16)
%18 = tail call i32 @putchar(i32 58)
%19 = getelementptr inbounds i8, i8* %0, i64 4
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = tail call i32 @putchar(i32 %21)
%23 = getelementptr inbounds i8, i8* %0, i64 5
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = tail call i32 @putchar(i32 %25)
%27 = tail call i32 @putchar(i32 58)
%28 = getelementptr inbounds i8, i8* %0, i64 6
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = tail call i32 @putchar(i32 %30)
%32 = getelementptr inbounds i8, i8* %0, i64 7
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = tail call i32 @putchar(i32 %34)
%36 = tail call i32 @putchar(i32 58)
%37 = getelementptr inbounds i8, i8* %0, i64 8
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = tail call i32 @putchar(i32 %39)
%41 = getelementptr inbounds i8, i8* %0, i64 9
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = tail call i32 @putchar(i32 %43)
%45 = tail call i32 @putchar(i32 58)
%46 = getelementptr inbounds i8, i8* %0, i64 10
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = tail call i32 @putchar(i32 %48)
%50 = getelementptr inbounds i8, i8* %0, i64 11
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = tail call i32 @putchar(i32 %52)
ret void
}