#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 */
scalar_t__ isspace(char);
char *get_ifname_from_buff(char *buff) {
  char *s;
  while (isspace(*buff))
    ++buff;
  s = buff;
  while (':' != *buff && '\0' != *buff)
    ++buff;
  *buff = '\0';
  return s;
}


x86 assembly (clang, -O0):
<get_ifname_from_buff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1143 <get_ifname_from_buff+0x33>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <get_ifname_from_buff+0xc>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
mov    $0x3a,%ecx
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     1175 <get_ifname_from_buff+0x65>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1185 <get_ifname_from_buff+0x75>
jmp    1196 <get_ifname_from_buff+0x86>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114b <get_ifname_from_buff+0x3b>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ifname_from_buff>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <get_ifname_from_buff+0x10>
mov    %rbx,%rax
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rax),%ecx
test   %cl,%cl
je     1152 <get_ifname_from_buff+0x42>
cmp    $0x3a,%cl
je     1152 <get_ifname_from_buff+0x42>
add    $0x1,%rax
jmp    1140 <get_ifname_from_buff+0x30>
movb   $0x0,(%rax)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @get_ifname_from_buff(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2, %11
%9 = phi i8* [ %12, %11 ], [ %3, %2 ]
%10 = load i8, i8* %9
switch i8 %10, label %11 [
i8 58, label %13
i8 0, label %13
]
11: ; preds = %8
%12 = getelementptr inbounds i8, i8* %9, i64 1
br label %8
13: ; preds = %8, %8
store i8 0, i8* %9
ret i8* %3
}