#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 */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char, char, char, char, char, char,
                          int);
int sscanf(char *, char *, scalar_t__ *, scalar_t__ *, scalar_t__ *,
           scalar_t__ *, scalar_t__ *, scalar_t__ *);
int main(int argc, char *argv[]) {
  int num, i;
  uint32_t e[6];
  char eth_addr[6];
  char *addr = "00:11:22:33:44:55";
  num = sscanf(addr, "%02x:%02x:%02x:%02x:%02x:%02x", &e[0], &e[1], &e[2],
               &e[3], &e[4], &e[5]);
  for (i = 0; i < 6; i++) {
    eth_addr[i] = (char)e[i];
  }
  printf("%s -> %02x:%02x:%02x:%02x:%02x:%02x num: %d\n", addr, eth_addr[0],
         eth_addr[1], eth_addr[2], eth_addr[3], eth_addr[4], eth_addr[5], num);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    -0x50(%rbp),%rcx
add    $0x8,%rcx
lea    -0x50(%rbp),%r8
add    $0x10,%r8
lea    -0x50(%rbp),%r9
add    $0x18,%r9
lea    -0x50(%rbp),%r10
add    $0x20,%r10
lea    -0x50(%rbp),%rax
add    $0x28,%rax
lea    0xe87(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <sscanf@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x6,-0x18(%rbp)
jge    11ce <main+0x9e>
movslq -0x18(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %al,%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x56(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a3 <main+0x73>
mov    -0x60(%rbp),%rsi
mov    -0x56(%rbp),%dl
mov    -0x55(%rbp),%cl
mov    -0x54(%rbp),%r8b
mov    -0x53(%rbp),%r9b
mov    -0x52(%rbp),%r11b
mov    -0x51(%rbp),%r10b
mov    -0x14(%rbp),%eax
lea    0xe3e(%rip),%rdi
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r11b,%r11d
mov    %r11d,(%rsp)
movsbl %r10b,%r10d
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <printf@plt>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0x8(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0x18(%rsp),%r9
lea    0x20(%rsp),%r10
lea    0x28(%rsp),%rax
lea    0xea9(%rip),%r14
lea    0xeb4(%rip),%rsi
mov    %rsp,%rdx
mov    %r14,%rdi
push   %rax
push   %r10
call   1040 <sscanf@plt>
add    $0x10,%rsp
movsbl (%rsp),%edx
movsbl 0x8(%rsp),%ecx
movsbl 0x10(%rsp),%r8d
movsbl 0x18(%rsp),%r9d
movsbl 0x20(%rsp),%r10d
movsbl 0x28(%rsp),%ebx
sub    $0x8,%rsp
lea    0xe95(%rip),%rdi
mov    %r14,%rsi
push   %rax
push   %rbx
push   %r10
call   1030 <printf@plt>
add    $0x20,%rsp
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"00:11:22:33:44:55\00"
@.str.1 = [30 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\00"
@.str.2 = [45 x i8] c"%s -> %02x:%02x:%02x:%02x:%02x:%02x num: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [6 x i64]
%9 = alloca [6 x i8]
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = load i8*, i8** %10
%12 = getelementptr inbounds [6 x i64], [6 x i64]* %8, i64 0, i64 0
%13 = getelementptr inbounds [6 x i64], [6 x i64]* %8, i64 0, i64 1
%14 = getelementptr inbounds [6 x i64], [6 x i64]* %8, i64 0, i64 2
%15 = getelementptr inbounds [6 x i64], [6 x i64]* %8, i64 0, i64 3
%16 = getelementptr inbounds [6 x i64], [6 x i64]* %8, i64 0, i64 4
%17 = getelementptr inbounds [6 x i64], [6 x i64]* %8, i64 0, i64 5
%18 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i64* %12, i64* %13, i64* %14, i64* %15, i64* %16, i64* %17)
store i32 %18, i32* %6
store i32 0, i32* %7
br label %19
19: ; preds = %31, %2
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 6
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [6 x i64], [6 x i64]* %8, i64 0, i64 %24
%26 = load i64, i64* %25
%27 = trunc i64 %26 to i8
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 %29
store i8 %27, i8* %30
br label %31
31: ; preds = %22
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %19
34: ; preds = %19
%35 = load i8*, i8** %10
%36 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 0
%37 = load i8, i8* %36
%38 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 1
%39 = load i8, i8* %38
%40 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 2
%41 = load i8, i8* %40
%42 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 3
%43 = load i8, i8* %42
%44 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 4
%45 = load i8, i8* %44
%46 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i64 0, i64 5
%47 = load i8, i8* %46
%48 = load i32, i32* %6
%49 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %35, i8 signext %37, i8 signext %39, i8 signext %41, i8 signext %43, i8 signext %45, i8 signext %47, i32 %48)
%50 = load i32, i32* @EXIT_SUCCESS
%51 = call i32 @exit(i32 %50)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"00:11:22:33:44:55\00"
@.str.1 = [30 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\00"
@.str.2 = [45 x i8] c"%s -> %02x:%02x:%02x:%02x:%02x:%02x num: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i64]
%4 = bitcast [6 x i64]* %3 to i8*
%5 = getelementptr inbounds [6 x i64], [6 x i64]* %3, i64 0, i64 0
%6 = getelementptr inbounds [6 x i64], [6 x i64]* %3, i64 0, i64 1
%7 = getelementptr inbounds [6 x i64], [6 x i64]* %3, i64 0, i64 2
%8 = getelementptr inbounds [6 x i64], [6 x i64]* %3, i64 0, i64 3
%9 = getelementptr inbounds [6 x i64], [6 x i64]* %3, i64 0, i64 4
%10 = getelementptr inbounds [6 x i64], [6 x i64]* %3, i64 0, i64 5
%11 = call i32 @sscanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i64* %5, i64* %6, i64* %7, i64* %8, i64* %9, i64* %10)
%12 = load i64, i64* %5
%13 = trunc i64 %12 to i8
%14 = load i64, i64* %6
%15 = trunc i64 %14 to i8
%16 = load i64, i64* %7
%17 = trunc i64 %16 to i8
%18 = load i64, i64* %8
%19 = trunc i64 %18 to i8
%20 = load i64, i64* %9
%21 = trunc i64 %20 to i8
%22 = load i64, i64* %10
%23 = trunc i64 %22 to i8
%24 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 signext %13, i8 signext %15, i8 signext %17, i8 signext %19, i8 signext %21, i8 signext %23, i32 %11)
%25 = load i32, i32* @EXIT_SUCCESS
%26 = call i32 @exit(i32 %25)
unreachable
}