#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 EX_OK;
int /*<<< orphan*/ get_radio_state(char *);
int /*<<< orphan*/ get_statistics(char *);
int getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ optind;
int /*<<< orphan*/ setprogname(char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int ch;
  char *iface = NULL;
  int noflag = 1, rflag = 0;
  setprogname(argv[0]);
  if (argc > 1 && argv[1][0] != '-') {
    iface = argv[1];
    optind++;
  }
  while ((ch = getopt(argc, argv, "i:r")) != -1) {
    if (ch != 'i')
      noflag = 0;
    switch (ch) {
    case 'i':
      iface = optarg;
      break;
    case 'r':
      rflag = 1;
      break;
    default:
      usage();
    }
  }
  if (iface == NULL)
    usage();
  if (rflag)
    get_radio_state(iface);
  if (noflag)
    get_statistics(iface);
  return EX_OK;
}


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)
movq   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <setprogname@plt>
cmpl   $0x1,-0x8(%rbp)
jle    11c7 <main+0x77>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     11c7 <main+0x77>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e27(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2e1b(%rip),%rax
mov    %ecx,(%rax)
jmp    11cc <main+0x7c>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe26(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     124c <main+0xfc>
cmpl   $0x69,-0x14(%rbp)
je     11fc <main+0xac>
movl   $0x0,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x69,%eax
je     1221 <main+0xd1>
jmp    1210 <main+0xc0>
mov    -0x2c(%rbp),%eax
sub    $0x72,%eax
je     1234 <main+0xe4>
jmp    1240 <main+0xf0>
mov    0x2dd0(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1247 <main+0xf7>
movl   $0x1,-0x28(%rbp)
jmp    1247 <main+0xf7>
mov    $0x0,%al
call   1040 <usage@plt>
jmp    11cc <main+0x7c>
cmpq   $0x0,-0x20(%rbp)
jne    125e <main+0x10e>
mov    $0x0,%al
call   1040 <usage@plt>
cmpl   $0x0,-0x28(%rbp)
je     1271 <main+0x121>
mov    -0x20(%rbp),%rdi
call   1070 <get_radio_state@plt>
cmpl   $0x0,-0x24(%rbp)
je     1284 <main+0x134>
mov    -0x20(%rbp),%rdi
call   1030 <get_statistics@plt>
mov    0x2d45(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r13d
mov    (%rsi),%rdi
call   1060 <setprogname@plt>
xor    %r12d,%r12d
cmp    $0x2,%r13d
jl     117c <main+0x2c>
mov    0x8(%rbx),%r14
cmpb   $0x2d,(%r14)
jne    1181 <main+0x31>
xor    %r14d,%r14d
jmp    118b <main+0x3b>
mov    0x2e58(%rip),%rax
addl   $0x1,(%rax)
mov    $0x1,%ebp
lea    0xe69(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <getopt@plt>
cmp    $0xffffffff,%eax
je     11de <main+0x8e>
cmp    $0x72,%eax
je     11c8 <main+0x78>
cmp    $0x69,%eax
je     11d2 <main+0x82>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <usage@plt>
jmp    11a0 <main+0x50>
mov    $0x1,%r12d
xor    %ebp,%ebp
jmp    11a0 <main+0x50>
mov    0x2e1f(%rip),%rax
mov    (%rax),%r14
jmp    11a0 <main+0x50>
test   %r14,%r14
je     1214 <main+0xc4>
test   %r12d,%r12d
je     11f0 <main+0xa0>
mov    %r14,%rdi
call   1070 <get_radio_state@plt>
test   %ebp,%ebp
je     11fc <main+0xac>
mov    %r14,%rdi
call   1030 <get_statistics@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1040 <usage@plt>
test   %r12d,%r12d
jne    11e8 <main+0x98>
jmp    11f0 <main+0xa0>

LLVM IR (-O0):
@optind = global i32 0
@.str = [4 x i8] c"i:r\00"
@optarg = global i8* null
@EX_OK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
store i32 1, i32* %8
store i32 0, i32* %9
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @setprogname(i8* %12)
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %30
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 45
br i1 %23, label %24, label %30
24: ; preds = %16
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
store i8* %27, i8** %7
%28 = load i32, i32* @optind
%29 = add nsw i32 %28, 1
store i32 %29, i32* @optind
br label %30
30: ; preds = %24, %16, %2
br label %31
31: ; preds = %47, %30
%32 = load i32, i32* %4
%33 = load i8**, i8*** %5
%34 = call i32 @getopt(i32 %32, i8** %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %34, i32* %6
%35 = icmp ne i32 %34, -1
br i1 %35, label %36, label %48
36: ; preds = %31
%37 = load i32, i32* %6
%38 = icmp ne i32 %37, 105
br i1 %38, label %39, label %40
39: ; preds = %36
store i32 0, i32* %8
br label %40
40: ; preds = %39, %36
%41 = load i32, i32* %6
switch i32 %41, label %45 [
i32 105, label %42
i32 114, label %44
]
42: ; preds = %40
%43 = load i8*, i8** @optarg
store i8* %43, i8** %7
br label %47
44: ; preds = %40
store i32 1, i32* %9
br label %47
45: ; preds = %40
%46 = call i32 (...) @usage()
br label %47
47: ; preds = %45, %44, %42
br label %31
48: ; preds = %31
%49 = load i8*, i8** %7
%50 = icmp eq i8* %49, null
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = call i32 (...) @usage()
br label %53
53: ; preds = %51, %48
%54 = load i32, i32* %9
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = load i8*, i8** %7
%58 = call i32 @get_radio_state(i8* %57)
br label %59
59: ; preds = %56, %53
%60 = load i32, i32* %8
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = load i8*, i8** %7
%64 = call i32 @get_statistics(i8* %63)
br label %65
65: ; preds = %62, %59
%66 = load i32, i32* @EX_OK
ret i32 %66
}

LLVM IR (-O2):
@optind = global i32 0
@.str = [4 x i8] c"i:r\00"
@optarg = global i8* null
@EX_OK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @setprogname(i8* %3)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 45
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = load i32, i32* @optind
%13 = add nsw i32 %12, 1
store i32 %13, i32* @optind
br label %14
14: ; preds = %11, %6, %2
%15 = phi i8* [ null, %2 ], [ null, %6 ], [ %8, %11 ]
br label %16
16: ; preds = %14, %26
%17 = phi i8* [ %15, %14 ], [ %27, %26 ]
%18 = phi i32 [ 1, %14 ], [ %24, %26 ]
%19 = phi i32 [ 0, %14 ], [ %22, %26 ]
br label %20
20: ; preds = %23, %16
%21 = phi i32 [ %18, %16 ], [ 0, %23 ]
%22 = phi i32 [ %19, %16 ], [ 1, %23 ]
br label %23
23: ; preds = %20, %28
%24 = phi i32 [ 0, %28 ], [ %21, %20 ]
%25 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
switch i32 %25, label %28 [
i32 -1, label %30
i32 105, label %26
i32 114, label %20
]
26: ; preds = %23
%27 = load i8*, i8** @optarg
br label %16
28: ; preds = %23
%29 = tail call i32 (...) @usage()
br label %23
30: ; preds = %23
%31 = icmp eq i8* %17, null
br i1 %31, label %32, label %34
32: ; preds = %30
%33 = tail call i32 (...) @usage()
br label %34
34: ; preds = %32, %30
%35 = icmp eq i32 %22, 0
br i1 %35, label %38, label %36
36: ; preds = %34
%37 = tail call i32 @get_radio_state(i8* %17)
br label %38
38: ; preds = %36, %34
%39 = icmp eq i32 %24, 0
br i1 %39, label %42, label %40
40: ; preds = %38
%41 = tail call i32 @get_statistics(i8* %17)
br label %42
42: ; preds = %40, %38
%43 = load i32, i32* @EX_OK
ret i32 %43
}