#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 */
int EXIT_FAILURE;
unsigned int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int recover_for_essid(int, char const *, char const *, unsigned int);
int /*<<< orphan*/ stderr;
int wapi_make_socket();
int main(int argc, char *argv[]) {
  const char *ifname;
  const char *essid;
  unsigned int maxdur;
  int sock;
  int ret;
  if (argc != 4) {
    fprintf(stderr, "Usage: %s <IFNAME> <ESSID> <MAXDUR>\n", argv[0]);
    return EXIT_FAILURE;
  }
  ifname = argv[1];
  essid = argv[2];
  maxdur = atoi(argv[3]);
  if ((sock = wapi_make_socket()) < 0)
    return EXIT_FAILURE;
  ret = recover_for_essid(sock, ifname, essid, maxdur);
  close(sock);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     119d <main+0x4d>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120d <main+0xbd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1060 <wapi_make_socket@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jge    11e9 <main+0x99>
mov    0x2df9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120d <main+0xbd>
mov    -0x28(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1050 <recover_for_essid@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%edi
call   1030 <close@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    1198 <main+0x48>
mov    0x8(%rsi),%r15
mov    0x10(%rsi),%r14
mov    0x18(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <wapi_make_socket@plt>
test   %eax,%eax
js     11b0 <main+0x60>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %ebp,%ecx
call   1050 <recover_for_essid@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <close@plt>
mov    %ebp,%eax
jmp    11b9 <main+0x69>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe55(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s <IFNAME> <ESSID> <MAXDUR>\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 4
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
store i32 %19, i32* %3
br label %44
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
store i8* %23, i8** %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
store i8* %26, i8** %7
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %8
%31 = call i32 (...) @wapi_make_socket()
store i32 %31, i32* %9
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %20
%34 = load i32, i32* @EXIT_FAILURE
store i32 %34, i32* %3
br label %44
35: ; preds = %20
%36 = load i32, i32* %9
%37 = load i8*, i8** %6
%38 = load i8*, i8** %7
%39 = load i32, i32* %8
%40 = call i32 @recover_for_essid(i32 %36, i8* %37, i8* %38, i32 %39)
store i32 %40, i32* %10
%41 = load i32, i32* %9
%42 = call i32 @close(i32 %41)
%43 = load i32, i32* %10
store i32 %43, i32* %3
br label %44
44: ; preds = %35, %33, %13
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s <IFNAME> <ESSID> <MAXDUR>\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
br label %24
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = tail call i32 (...) @wapi_make_socket()
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %9
%20 = load i32, i32* @EXIT_FAILURE
br label %24
21: ; preds = %9
%22 = tail call i32 @recover_for_essid(i32 %17, i8* %11, i8* %13, i32 %16)
%23 = tail call i32 @close(i32 %17)
br label %24
24: ; preds = %21, %19, %4
%25 = phi i32 [ %8, %4 ], [ %20, %19 ], [ %22, %21 ]
ret i32 %25
}