#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 *, char const *,
                            char const *, char const *, char const *,
                            char const *);
int wpa_ctrl_command(struct wpa_ctrl *, char *);
int wpa_cli_cmd_interface_add(struct wpa_ctrl *ctrl, int argc,
                              const char *argv[]) {
  char cmd[256];
  if (argc < 1) {
    printf("Invalid INTERFACE_ADD command: needs at least one "
           "argument (interface name)\n"
           "All arguments: ifname confname driver ctrl_interface "
           "driver_param bridge_name\n");
    return -1;
  }
  snprintf(cmd, sizeof(cmd), "INTERFACE_ADD %s\t%s\t%s\t%s\t%s\t%s", argv[0],
           argc > 1 ? argv[1] : "", argc > 2 ? argv[2] : "",
           argc > 3 ? argv[3] : "", argc > 4 ? argv[4] : "",
           argc > 5 ? argv[5] : "");
  cmd[sizeof(cmd) - 1] = '\0';
  return wpa_ctrl_command(ctrl, cmd);
}


x86 assembly (clang, -O0):
<wpa_cli_cmd_interface_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    1168 <wpa_cli_cmd_interface_add+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1318 <wpa_cli_cmd_interface_add+0x1e8>
lea    -0x120(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x128(%rbp)
cmpl   $0x1,-0x14(%rbp)
jle    11a2 <wpa_cli_cmd_interface_add+0x72>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x138(%rbp)
jmp    11b5 <wpa_cli_cmd_interface_add+0x85>
lea    0xef1(%rip),%rax
mov    %rax,-0x138(%rbp)
jmp    11b5 <wpa_cli_cmd_interface_add+0x85>
mov    -0x138(%rbp),%rax
mov    %rax,-0x140(%rbp)
cmpl   $0x2,-0x14(%rbp)
jle    11e1 <wpa_cli_cmd_interface_add+0xb1>
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x148(%rbp)
jmp    11f4 <wpa_cli_cmd_interface_add+0xc4>
lea    0xeb2(%rip),%rax
mov    %rax,-0x148(%rbp)
jmp    11f4 <wpa_cli_cmd_interface_add+0xc4>
mov    -0x148(%rbp),%rax
mov    %rax,-0x150(%rbp)
cmpl   $0x3,-0x14(%rbp)
jle    1220 <wpa_cli_cmd_interface_add+0xf0>
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x158(%rbp)
jmp    1233 <wpa_cli_cmd_interface_add+0x103>
lea    0xe73(%rip),%rax
mov    %rax,-0x158(%rbp)
jmp    1233 <wpa_cli_cmd_interface_add+0x103>
mov    -0x158(%rbp),%rax
mov    %rax,-0x160(%rbp)
cmpl   $0x4,-0x14(%rbp)
jle    125f <wpa_cli_cmd_interface_add+0x12f>
mov    -0x20(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x168(%rbp)
jmp    1272 <wpa_cli_cmd_interface_add+0x142>
lea    0xe34(%rip),%rax
mov    %rax,-0x168(%rbp)
jmp    1272 <wpa_cli_cmd_interface_add+0x142>
mov    -0x168(%rbp),%rax
mov    %rax,-0x170(%rbp)
cmpl   $0x5,-0x14(%rbp)
jle    129e <wpa_cli_cmd_interface_add+0x16e>
mov    -0x20(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x178(%rbp)
jmp    12b1 <wpa_cli_cmd_interface_add+0x181>
lea    0xdf5(%rip),%rax
mov    %rax,-0x178(%rbp)
jmp    12b1 <wpa_cli_cmd_interface_add+0x181>
mov    -0x170(%rbp),%r10
mov    -0x160(%rbp),%r11
mov    -0x150(%rbp),%r9
mov    -0x140(%rbp),%r8
mov    -0x128(%rbp),%rcx
mov    -0x130(%rbp),%rdi
mov    -0x178(%rbp),%rax
mov    $0x100,%esi
lea    0xdad(%rip),%rdx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <snprintf@plt>
movb   $0x0,-0x21(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1050 <wpa_ctrl_command@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wpa_cli_cmd_interface_add>:
push   %r14
push   %rbx
sub    $0x108,%rsp
test   %esi,%esi
jle    115b <wpa_cli_cmd_interface_add+0x2b>
mov    %rdi,%r14
mov    (%rdx),%rcx
lea    0xf6e(%rip),%rax
cmp    $0x1,%esi
jne    116e <wpa_cli_cmd_interface_add+0x3e>
mov    %rax,%r10
mov    %rax,%r9
mov    %rax,%r8
jmp    1188 <wpa_cli_cmd_interface_add+0x58>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
jmp    11c4 <wpa_cli_cmd_interface_add+0x94>
mov    0x8(%rdx),%r8
cmp    $0x3,%esi
jb     1182 <wpa_cli_cmd_interface_add+0x52>
mov    0x10(%rdx),%r9
jne    11cf <wpa_cli_cmd_interface_add+0x9f>
mov    %rax,%r10
jmp    1188 <wpa_cli_cmd_interface_add+0x58>
mov    %rax,%r10
mov    %rax,%r9
mov    %rax,%r11
sub    $0x8,%rsp
lea    0xe6a(%rip),%rdx
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
push   %rax
push   %r10
push   %r11
call   1040 <snprintf@plt>
add    $0x20,%rsp
movb   $0x0,0xff(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <wpa_ctrl_command@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret
mov    0x18(%rdx),%r11
cmp    $0x5,%esi
jb     11e4 <wpa_cli_cmd_interface_add+0xb4>
mov    0x20(%rdx),%r10
je     118b <wpa_cli_cmd_interface_add+0x5b>
mov    0x28(%rdx),%rax
jmp    118b <wpa_cli_cmd_interface_add+0x5b>
mov    %rax,%r10
jmp    118b <wpa_cli_cmd_interface_add+0x5b>

LLVM IR (-O0):
%struct.wpa_ctrl = type { i32 }
@.str = [155 x i8] c"Invalid INTERFACE_ADD command: needs at least one argument (interface name)\0AAll arguments: ifname confname driver ctrl_interface driver_param bridge_name\0A\00"
@.str.1 = [32 x i8] c"INTERFACE_ADD %s\09%s\09%s\09%s\09%s\09%s\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @wpa_cli_cmd_interface_add(%struct.wpa_ctrl* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca %struct.wpa_ctrl*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca [256 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 slt i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 @printf(i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %68
13: ; preds = %3
%14 = getelementptr inbounds [256 x i8], [256 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 = load i32, i32* %6
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %24
20: ; preds = %13
%21 = load i8**, i8*** %7
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
br label %25
24: ; preds = %13
br label %25
25: ; preds = %24, %20
%26 = phi i8* [ %23, %20 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %24 ]
%27 = load i32, i32* %6
%28 = icmp sgt i32 %27, 2
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = load i8**, i8*** %7
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
br label %34
33: ; preds = %25
br label %34
34: ; preds = %33, %29
%35 = phi i8* [ %32, %29 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %33 ]
%36 = load i32, i32* %6
%37 = icmp sgt i32 %36, 3
br i1 %37, label %38, label %42
38: ; preds = %34
%39 = load i8**, i8*** %7
%40 = getelementptr inbounds i8*, i8** %39, i64 3
%41 = load i8*, i8** %40
br label %43
42: ; preds = %34
br label %43
43: ; preds = %42, %38
%44 = phi i8* [ %41, %38 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %42 ]
%45 = load i32, i32* %6
%46 = icmp sgt i32 %45, 4
br i1 %46, label %47, label %51
47: ; preds = %43
%48 = load i8**, i8*** %7
%49 = getelementptr inbounds i8*, i8** %48, i64 4
%50 = load i8*, i8** %49
br label %52
51: ; preds = %43
br label %52
52: ; preds = %51, %47
%53 = phi i8* [ %50, %47 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %51 ]
%54 = load i32, i32* %6
%55 = icmp sgt i32 %54, 5
br i1 %55, label %56, label %60
56: ; preds = %52
%57 = load i8**, i8*** %7
%58 = getelementptr inbounds i8*, i8** %57, i64 5
%59 = load i8*, i8** %58
br label %61
60: ; preds = %52
br label %61
61: ; preds = %60, %56
%62 = phi i8* [ %59, %56 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %60 ]
%63 = call i32 @snprintf(i8* %14, i32 256, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %26, i8* %35, i8* %44, i8* %53, i8* %62)
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 255
store i8 0, i8* %64
%65 = load %struct.wpa_ctrl*, %struct.wpa_ctrl** %5
%66 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%67 = call i32 @wpa_ctrl_command(%struct.wpa_ctrl* %65, i8* %66)
store i32 %67, i32* %4
br label %68
68: ; preds = %61, %11
%69 = load i32, i32* %4
ret i32 %69
}

LLVM IR (-O2):
%struct.wpa_ctrl = type { i32 }
@.str.1 = [32 x i8] c"INTERFACE_ADD %s\09%s\09%s\09%s\09%s\09%s\00"
@.str.2 = [1 x i8] zeroinitializer
@str = [154 x i8] c"Invalid INTERFACE_ADD command: needs at least one argument (interface name)\0AAll arguments: ifname confname driver ctrl_interface driver_param bridge_name\00"
define i32 @wpa_cli_cmd_interface_add(%struct.wpa_ctrl* %0, i32 %1, i8** nocapture %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = icmp slt i32 %1, 1
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([154 x i8], [154 x i8]* @str, i64 0, i64 0))
br label %40
9: ; preds = %3
%10 = load i8*, i8** %2
%11 = icmp eq i32 %1, 1
br i1 %11, label %31, label %12
12: ; preds = %9
%13 = getelementptr inbounds i8*, i8** %2, i64 1
%14 = load i8*, i8** %13
%15 = icmp ugt i32 %1, 2
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = getelementptr inbounds i8*, i8** %2, i64 2
%18 = load i8*, i8** %17
%19 = icmp eq i32 %1, 3
br i1 %19, label %31, label %20
20: ; preds = %16
%21 = getelementptr inbounds i8*, i8** %2, i64 3
%22 = load i8*, i8** %21
%23 = icmp ugt i32 %1, 4
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = getelementptr inbounds i8*, i8** %2, i64 4
%26 = load i8*, i8** %25
%27 = icmp eq i32 %1, 5
br i1 %27, label %31, label %28
28: ; preds = %24
%29 = getelementptr inbounds i8*, i8** %2, i64 5
%30 = load i8*, i8** %29
br label %31
31: ; preds = %9, %12, %16, %20, %24, %28
%32 = phi i8* [ %26, %28 ], [ %26, %24 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %20 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %16 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %12 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %9 ]
%33 = phi i8* [ %18, %28 ], [ %18, %24 ], [ %18, %20 ], [ %18, %16 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %12 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %9 ]
%34 = phi i8* [ %14, %28 ], [ %14, %24 ], [ %14, %20 ], [ %14, %16 ], [ %14, %12 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %9 ]
%35 = phi i8* [ %22, %28 ], [ %22, %24 ], [ %22, %20 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %16 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %12 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %9 ]
%36 = phi i8* [ %30, %28 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %24 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %20 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %16 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %12 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %9 ]
%37 = call i32 @snprintf(i8* %5, i32 256, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %34, i8* %33, i8* %35, i8* %32, i8* %36)
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 255
store i8 0, i8* %38
%39 = call i32 @wpa_ctrl_command(%struct.wpa_ctrl* %0, i8* %5)
br label %40
40: ; preds = %31, %7
%41 = phi i32 [ -1, %7 ], [ %39, %31 ]
ret i32 %41
}