#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 /*<<< orphan*/ atoi(int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ test_af_unix(int);
int /*<<< orphan*/ test_ifa();
int /*<<< orphan*/ test_socketpair();
int main(int argc, char *argv[]) {
  int opt;
  while ((opt = getopt(argc, argv, "pau:")) != -1) {
    switch (opt) {
    case 'p':
      test_socketpair();
      break;
    case 'a':
      test_ifa();
      break;
    case 'u': {
      int flag = atoi(optarg) ? 1 : 0;
      test_af_unix(flag);
      break;
    }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe8c(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1200 <main+0xb0>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x61,%eax
je     11c7 <main+0x77>
jmp    1199 <main+0x49>
mov    -0x1c(%rbp),%eax
sub    $0x70,%eax
je     11bb <main+0x6b>
jmp    11aa <main+0x5a>
mov    -0x1c(%rbp),%eax
sub    $0x75,%eax
je     11d3 <main+0x83>
jmp    11fb <main+0xab>
mov    $0x0,%al
call   1030 <test_socketpair@plt>
jmp    11fb <main+0xab>
mov    $0x0,%al
call   1040 <test_ifa@plt>
jmp    11fb <main+0xab>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <test_af_unix@plt>
jmp    1166 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe9d(%rip),%r14
mov    0x2e8e(%rip),%r15
jmp    1185 <main+0x35>
nopl   0x0(%rax)
mov    (%r15),%edi
call   1070 <atoi@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
call   1050 <test_af_unix@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
cmp    $0x6f,%eax
jle    11b0 <main+0x60>
cmp    $0x75,%eax
je     1170 <main+0x20>
cmp    $0x70,%eax
jne    1185 <main+0x35>
xor    %eax,%eax
call   1030 <test_socketpair@plt>
jmp    1185 <main+0x35>
nopw   0x0(%rax,%rax,1)
cmp    $0x61,%eax
jne    11be <main+0x6e>
xor    %eax,%eax
call   1040 <test_ifa@plt>
jmp    1185 <main+0x35>
cmp    $0xffffffff,%eax
jne    1185 <main+0x35>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"pau:\00"
@optarg = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %27, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %28
13: ; preds = %8
%14 = load i32, i32* %6
switch i32 %14, label %27 [
i32 112, label %15
i32 97, label %17
i32 117, label %19
]
15: ; preds = %13
%16 = call i32 (...) @test_socketpair()
br label %27
17: ; preds = %13
%18 = call i32 (...) @test_ifa()
br label %27
19: ; preds = %13
%20 = load i32, i32* @optarg
%21 = call i32 @atoi(i32 %20)
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 1, i32 0
store i32 %24, i32* %7
%25 = load i32, i32* %7
%26 = call i32 @test_af_unix(i32 %25)
br label %27
27: ; preds = %13, %19, %17, %15
br label %8
28: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"pau:\00"
@optarg = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %2
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %5 [
i32 -1, label %16
i32 112, label %6
i32 97, label %8
i32 117, label %10
]
5: ; preds = %3, %10, %8, %6
br label %3
6: ; preds = %3
%7 = tail call i32 (...) @test_socketpair()
br label %5
8: ; preds = %3
%9 = tail call i32 (...) @test_ifa()
br label %5
10: ; preds = %3
%11 = load i32, i32* @optarg
%12 = tail call i32 @atoi(i32 %11)
%13 = icmp ne i32 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @test_af_unix(i32 %14)
br label %5
16: ; preds = %3
ret i32 0
}