#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
char *ltrim(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strtok(char *, char *);
void get_next_iface(FILE *fd, char *ifname) {
  char buf[161];
  if (!feof(fd)) {
    strcpy(buf, "");
    fgets(buf, 160, fd);
    if (strcmp(buf, "") != 0)
      strcpy(ifname, ltrim(strtok(buf, ":")));
    else
      strcpy(ifname, "");
  } else
    strcpy(ifname, "");
}


x86 assembly (clang, -O0):
<get_next_iface>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
jne    1218 <get_next_iface+0xb8>
lea    -0xc0(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xc0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xa0,%esi
call   1040 <fgets@plt>
lea    -0xc0(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1203 <get_next_iface+0xa3>
mov    -0x10(%rbp),%rax
mov    %rax,-0xc8(%rbp)
lea    -0xc0(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   1080 <strtok@plt>
mov    %eax,%edi
call   1070 <ltrim@plt>
mov    -0xc8(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
jmp    1213 <get_next_iface+0xb3>
mov    -0x10(%rbp),%rdi
lea    0xdf3(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1228 <get_next_iface+0xc8>
mov    -0x10(%rbp),%rdi
lea    0xdde(%rip),%rsi
call   1030 <strcpy@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_iface>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1060 <feof@plt>
test   %eax,%eax
je     119a <get_next_iface+0x3a>
lea    0xe7d(%rip),%rsi
mov    %r14,%rdi
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <strcpy@plt>
lea    0xe60(%rip),%r15
mov    %rsp,%r12
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    $0xa0,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11ed <get_next_iface+0x8d>
lea    0xe2a(%rip),%rsi
mov    %rsp,%rdi
call   1080 <strtok@plt>
mov    %eax,%edi
call   1070 <ltrim@plt>
mov    %r14,%rdi
mov    %rax,%rsi
jmp    11f7 <get_next_iface+0x97>
lea    0xe0d(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c":\00"
define void @get_next_iface(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [161 x i8]
store i32* %0, i32** %3
store i8* %1, i8** %4
%6 = load i32*, i32** %3
%7 = call i32 @feof(i32* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %28, label %9
9: ; preds = %2
%10 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%13 = load i32*, i32** %3
%14 = call i32 @fgets(i8* %12, i32 160, i32* %13)
%15 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %9
%19 = load i8*, i8** %4
%20 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%21 = call i32 @strtok(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = call i8* @ltrim(i32 %21)
%23 = call i32 @strcpy(i8* %19, i8* %22)
br label %27
24: ; preds = %9
%25 = load i8*, i8** %4
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %24, %18
br label %31
28: ; preds = %2
%29 = load i8*, i8** %4
%30 = call i32 @strcpy(i8* %29, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %28, %27
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c":\00"
define void @get_next_iface(i32* nocapture %0, i8* %1) {
%3 = alloca [161 x i8]
%4 = getelementptr inbounds [161 x i8], [161 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @feof(i32* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @fgets(i8* %4, i32 160, i32* %0)
%10 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %7
%13 = call i32 @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = call i8* @ltrim(i32 %13)
%15 = call i32 @strcpy(i8* %1, i8* %14)
br label %20
16: ; preds = %7
%17 = call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %20
18: ; preds = %2
%19 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %12, %16, %18
ret void
}