#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 wpa_ctrl {
  int dummy;
};
typedef int /*<<< orphan*/ cmd;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int wpa_ctrl_command(struct wpa_ctrl *, char *);
int wpa_cli_cmd_interface_remove(struct wpa_ctrl *ctrl, int argc,
                                 const char *argv[]) {
  char cmd[128];
  if (argc != 1) {
    printf("Invalid INTERFACE_REMOVE command: needs one argument "
           "(interface name)\n");
    return -1;
  }
  snprintf(cmd, sizeof(cmd), "INTERFACE_REMOVE %s", argv[0]);
  cmd[sizeof(cmd) - 1] = '\0';
  return wpa_ctrl_command(ctrl, cmd);
}


x86 assembly (clang, -O0):
<wpa_cli_cmd_interface_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     1168 <wpa_cli_cmd_interface_remove+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    119e <wpa_cli_cmd_interface_remove+0x6e>
lea    -0xa0(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
mov    $0x80,%esi
lea    0xec5(%rip),%rdx
call   1040 <snprintf@plt>
movb   $0x0,-0x21(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1050 <wpa_ctrl_command@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wpa_cli_cmd_interface_remove>:
push   %r14
push   %rbx
sub    $0x88,%rsp
cmp    $0x1,%esi
jne    116e <wpa_cli_cmd_interface_remove+0x3e>
mov    %rdi,%rbx
mov    (%rdx),%rcx
lea    0xeb4(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x80,%esi
call   1040 <snprintf@plt>
movb   $0x0,0x7f(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <wpa_ctrl_command@plt>
jmp    117f <wpa_cli_cmd_interface_remove+0x4f>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.wpa_ctrl = type { i32 }
@.str = [71 x i8] c"Invalid INTERFACE_REMOVE command: needs one argument (interface name)\0A\00"
@.str.1 = [20 x i8] c"INTERFACE_REMOVE %s\00"
define i32 @wpa_cli_cmd_interface_remove(%struct.wpa_ctrl* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca %struct.wpa_ctrl*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca [128 x i8]
store %struct.wpa_ctrl* %0, %struct.wpa_ctrl** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %23
13: ; preds = %3
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%15 = load i8**, i8*** %7
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @snprintf(i8* %14, i32 128, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 127
store i8 0, i8* %19
%20 = load %struct.wpa_ctrl*, %struct.wpa_ctrl** %5
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%22 = call i32 @wpa_ctrl_command(%struct.wpa_ctrl* %20, i8* %21)
store i32 %22, i32* %4
br label %23
23: ; preds = %13, %11
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
%struct.wpa_ctrl = type { i32 }
@.str.1 = [20 x i8] c"INTERFACE_REMOVE %s\00"
@str = [70 x i8] c"Invalid INTERFACE_REMOVE command: needs one argument (interface name)\00"
define i32 @wpa_cli_cmd_interface_remove(%struct.wpa_ctrl* %0, i32 %1, i8** nocapture %2) {
%4 = alloca [128 x i8]
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%6 = icmp eq i32 %1, 1
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
br label %14
9: ; preds = %3
%10 = load i8*, i8** %2
%11 = call i32 @snprintf(i8* %5, i32 128, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 127
store i8 0, i8* %12
%13 = call i32 @wpa_ctrl_command(%struct.wpa_ctrl* %0, i8* %5)
br label %14
14: ; preds = %9, %7
%15 = phi i32 [ -1, %7 ], [ %13, %9 ]
ret i32 %15
}