#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*/ qbssid;

/* Variables and functions */
int /*<<< orphan*/ _bssid_quote(char *, char *);
int assert(int);
int c_escape(char *, char *, int);
int /*<<< orphan*/ errx(int, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int profile_name(char *, char *, int);
int main(int argc, char *argv[]) {
  char qbssid[(6 * (sizeof "\\x00" - 1)) + 3];
  char nwid[1024];
  char profile[64];
  int r;
  if (argc != 4)
    errx(1, "argc");
  if ((r = (assert(sizeof(qbssid) > (6 * (sizeof "\\x00" - 1)) + 2),
            _bssid_quote(argv[2], qbssid))) == -1)
    errx(1, "bssid_quote");
  if (sizeof nwid < c_escape(argv[1], nwid, sizeof nwid))
    errx(1, "nwid");
  if (sizeof profile < profile_name(argv[3], profile, sizeof profile))
    errx(1, "profile");
  printf("\t{ \"%s\", %s, %s },\n", nwid, qbssid, profile);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11a4 <main+0x34>
mov    $0x1,%edi
lea    0xe61(%rip),%rsi
call   1050 <errx@plt>
mov    $0x1,%edi
call   1080 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <_bssid_quote@plt>
mov    %eax,-0x474(%rbp)
cmp    $0xffffffff,%eax
jne    11df <main+0x6f>
mov    $0x1,%edi
lea    0xe2b(%rip),%rsi
call   1050 <errx@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
call   1040 <c_escape@plt>
movslq %eax,%rcx
mov    $0x400,%eax
cmp    %rcx,%rax
jae    121a <main+0xaa>
mov    $0x1,%edi
lea    0xdfc(%rip),%rsi
call   1050 <errx@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    -0x470(%rbp),%rsi
mov    $0x40,%edx
call   1070 <profile_name@plt>
movslq %eax,%rcx
mov    $0x40,%eax
cmp    %rcx,%rax
jae    1255 <main+0xe5>
mov    $0x1,%edi
lea    0xdc6(%rip),%rsi
call   1050 <errx@plt>
lea    -0x430(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x470(%rbp),%rcx
lea    0xdb0(%rip),%rdi
call   1060 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x460,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
je     1191 <main+0x21>
lea    0xe79(%rip),%rsi
mov    $0x1,%edi
call   1050 <errx@plt>
mov    $0x1,%edi
call   1080 <assert@plt>
mov    0x10(%rbx),%rdi
mov    %rsp,%rsi
call   1030 <_bssid_quote@plt>
cmp    $0xffffffff,%eax
jne    11bd <main+0x4d>
lea    0xe52(%rip),%rsi
mov    $0x1,%edi
call   1050 <errx@plt>
mov    0x8(%rbx),%rdi
lea    0x60(%rsp),%rsi
mov    $0x400,%edx
call   1040 <c_escape@plt>
cmp    $0x401,%eax
jb     11e8 <main+0x78>
lea    0xe33(%rip),%rsi
mov    $0x1,%edi
call   1050 <errx@plt>
mov    0x18(%rbx),%rdi
lea    0x20(%rsp),%rsi
mov    $0x40,%edx
call   1070 <profile_name@plt>
cmp    $0x41,%eax
jb     1211 <main+0xa1>
lea    0xe0f(%rip),%rsi
mov    $0x1,%edi
call   1050 <errx@plt>
lea    0xe06(%rip),%rdi
lea    0x60(%rsp),%rsi
mov    %rsp,%rdx
lea    0x20(%rsp),%rcx
call   1060 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"argc\00"
@.str.1 = [12 x i8] c"bssid_quote\00"
@.str.2 = [5 x i8] c"nwid\00"
@.str.3 = [8 x i8] c"profile\00"
@.str.4 = [20 x i8] c"\09{ \22%s\22, %s, %s },\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [27 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [64 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 4
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @errx(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
%15 = call i32 @assert(i32 1)
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = getelementptr inbounds [27 x i8], [27 x i8]* %6, i64 0, i64 0
%20 = call i32 @_bssid_quote(i8* %18, i8* %19)
store i32 %20, i32* %9
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %14
%23 = call i32 @errx(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %14
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%29 = call i32 @c_escape(i8* %27, i8* %28, i32 1024)
%30 = sext i32 %29 to i64
%31 = icmp ult i64 1024, %30
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = call i32 @errx(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %24
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%39 = call i32 @profile_name(i8* %37, i8* %38, i32 64)
%40 = sext i32 %39 to i64
%41 = icmp ult i64 64, %40
br i1 %41, label %42, label %44
42: ; preds = %34
%43 = call i32 @errx(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %44
44: ; preds = %42, %34
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%46 = getelementptr inbounds [27 x i8], [27 x i8]* %6, i64 0, i64 0
%47 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%48 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %45, i8* %46, i8* %47)
%49 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"argc\00"
@.str.1 = [12 x i8] c"bssid_quote\00"
@.str.2 = [5 x i8] c"nwid\00"
@.str.3 = [8 x i8] c"profile\00"
@.str.4 = [20 x i8] c"\09{ \22%s\22, %s, %s },\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [27 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [64 x i8]
%6 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 4
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = tail call i32 @assert(i32 1)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = call i32 @_bssid_quote(i8* %15, i8* %6)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @errx(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %12
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @c_escape(i8* %22, i8* %7, i32 1024)
%24 = icmp ugt i32 %23, 1024
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 @errx(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %20
%28 = getelementptr inbounds i8*, i8** %1, i64 3
%29 = load i8*, i8** %28
%30 = call i32 @profile_name(i8* %29, i8* %8, i32 64)
%31 = icmp ugt i32 %30, 64
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = call i32 @errx(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32, %27
%35 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %7, i8* %6, i8* %8)
%36 = call i32 @exit(i32 0)
unreachable
}