#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 */
struct sigma_dut {
  int dummy;
};

/* Variables and functions */
scalar_t__ if_nametoindex(char *);
int /*<<< orphan*/ wpa_command(char *, char *);
void stop_sta_mode(struct sigma_dut *dut) {
  if (if_nametoindex("eth1") > 0) {
    wpa_command("eth1", "TERMINATE");
    return;
  }
  wpa_command("wlan0", "TERMINATE");
  wpa_command("wlan1", "TERMINATE");
  wpa_command("ath0", "TERMINATE");
  wpa_command("ath1", "TERMINATE");
}


x86 assembly (clang, -O0):
<stop_sta_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <if_nametoindex@plt>
cmp    $0x0,%rax
jle    115a <stop_sta_mode+0x3a>
lea    0xeb7(%rip),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <wpa_command@plt>
jmp    11a6 <stop_sta_mode+0x86>
lea    0xeae(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1040 <wpa_command@plt>
lea    0xea1(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1040 <wpa_command@plt>
lea    0xe94(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1040 <wpa_command@plt>
lea    0xe86(%rip),%rdi
lea    0xe64(%rip),%rsi
call   1040 <wpa_command@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stop_sta_mode>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <if_nametoindex@plt>
test   %rax,%rax
jg     1170 <stop_sta_mode+0x50>
lea    0xed3(%rip),%rdi
lea    0xec2(%rip),%rbx
mov    %rbx,%rsi
call   1040 <wpa_command@plt>
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
call   1040 <wpa_command@plt>
lea    0xeba(%rip),%rdi
mov    %rbx,%rsi
call   1040 <wpa_command@plt>
lea    0xeb0(%rip),%rbx
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <wpa_command@plt>

LLVM IR (-O0):
%struct.sigma_dut = type { i32 }
@.str = [5 x i8] c"eth1\00"
@.str.1 = [10 x i8] c"TERMINATE\00"
@.str.2 = [6 x i8] c"wlan0\00"
@.str.3 = [6 x i8] c"wlan1\00"
@.str.4 = [5 x i8] c"ath0\00"
@.str.5 = [5 x i8] c"ath1\00"
define void @stop_sta_mode(%struct.sigma_dut* %0) {
%2 = alloca %struct.sigma_dut*
store %struct.sigma_dut* %0, %struct.sigma_dut** %2
%3 = call i64 @if_nametoindex(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @wpa_command(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %12
7: ; preds = %1
%8 = call i32 @wpa_command(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @wpa_command(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @wpa_command(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @wpa_command(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
%struct.sigma_dut = type { i32 }
@.str = [5 x i8] c"eth1\00"
@.str.1 = [10 x i8] c"TERMINATE\00"
@.str.2 = [6 x i8] c"wlan0\00"
@.str.3 = [6 x i8] c"wlan1\00"
@.str.4 = [5 x i8] c"ath0\00"
@.str.5 = [5 x i8] c"ath1\00"
define void @stop_sta_mode(%struct.sigma_dut* nocapture readnone %0) {
%2 = tail call i64 @if_nametoindex(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp sgt i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @wpa_command(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @wpa_command(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @wpa_command(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ]
%10 = tail call i32 @wpa_command(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}