#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*/ strcpy(char *, char *);
void trimMacAddr(char *macAddr) {
  char temp[18];
  char *var = macAddr;
  int i = 0;
  while (*var) {
    if (*var != ':') {
      temp[i++] = *var;
      if (i == 18 - 1)
        break;
    }
    var++;
  }
  temp[i] = '\0';
  strcpy(macAddr, temp);
}


x86 assembly (clang, -O0):
<trimMacAddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     1184 <trimMacAddr+0x74>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     1173 <trimMacAddr+0x63>
mov    -0x28(%rbp),%rax
mov    (%rax),%cl
mov    -0x2c(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
cltq
mov    %cl,-0x20(%rbp,%rax,1)
cmpl   $0x11,-0x2c(%rbp)
jne    116e <trimMacAddr+0x5e>
jmp    1184 <trimMacAddr+0x74>
jmp    1173 <trimMacAddr+0x63>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    112b <trimMacAddr+0x1b>
movslq -0x2c(%rbp),%rax
movb   $0x0,-0x20(%rbp,%rax,1)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trimMacAddr>:
sub    $0x18,%rsp
xor    %eax,%eax
mov    %rdi,%rcx
jmp    1124 <trimMacAddr+0x14>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x3a,%dl
je     1120 <trimMacAddr+0x10>
test   %dl,%dl
je     1143 <trimMacAddr+0x33>
movslq %eax,%rsi
add    $0x1,%eax
mov    %dl,(%rsp,%rsi,1)
cmp    $0x11,%eax
jne    1120 <trimMacAddr+0x10>
mov    $0x11,%eax
cltq
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rsi
call   1030 <strcpy@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @trimMacAddr(i8* %0) {
%2 = alloca i8*
%3 = alloca [18 x i8]
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %4
store i32 0, i32* %5
br label %7
7: ; preds = %27, %1
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %30
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 58
br i1 %15, label %16, label %27
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 %21
store i8 %18, i8* %22
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 17
br i1 %24, label %25, label %26
25: ; preds = %16
br label %30
26: ; preds = %16
br label %27
27: ; preds = %26, %11
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %4
br label %7
30: ; preds = %25, %7
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 %32
store i8 0, i8* %33
%34 = load i8*, i8** %2
%35 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%36 = call i32 @strcpy(i8* %34, i8* %35)
ret void
}

LLVM IR (-O2):
define void @trimMacAddr(i8* %0) {
%2 = alloca [18 x i8]
%3 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %13, %1
%5 = phi i8* [ %0, %1 ], [ %15, %13 ]
%6 = phi i32 [ 0, %1 ], [ %14, %13 ]
%7 = load i8, i8* %5
switch i8 %7, label %8 [
i8 0, label %16
i8 58, label %13
]
8: ; preds = %4
%9 = add nsw i32 %6, 1
%10 = sext i32 %6 to i64
%11 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 %10
store i8 %7, i8* %11
%12 = icmp eq i32 %9, 17
br i1 %12, label %16, label %13
13: ; preds = %4, %8
%14 = phi i32 [ %9, %8 ], [ %6, %4 ]
%15 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
16: ; preds = %4, %8
%17 = phi i32 [ 17, %8 ], [ %6, %4 ]
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 %18
store i8 0, i8* %19
%20 = call i32 @strcpy(i8* %0, i8* %3)
ret void
}