#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*/ daemonize();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt(int, char **, char *);
int kill_daemon();
scalar_t__ opterr;
int /*<<< orphan*/ setup_radio();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ syslog_init();
int main(int argc, char **argv) {
  int c, kflag, sflag, dflag = 0;
  opterr = 0;
  while ((c = getopt(argc, argv, "skd")) != -1) {
    switch (c) {
    case 's':
      sflag = 1;
      break;
    case 'k':
      kflag = 1;
      break;
    case 'd':
      dflag = 1;
    default:
      break;
    }
  }
  if (kflag) {
    return kill_daemon();
  } else if (sflag) {
    daemonize();
    setup_radio();
  } else if (dflag) {
    syslog_init();
    setup_radio();
  } else {
    fprintf(stderr, "Bad argument: use [-s]tart or [-k]ill not both.\n");
  }
  return 0;
}


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)
movl   $0x0,-0x20(%rbp)
mov    0x2e54(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe67(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1209 <main+0xa9>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x64,%eax
je     11f8 <main+0x98>
jmp    11be <main+0x5e>
mov    -0x24(%rbp),%eax
sub    $0x6b,%eax
je     11ec <main+0x8c>
jmp    11cf <main+0x6f>
mov    -0x24(%rbp),%eax
sub    $0x73,%eax
jne    11ff <main+0x9f>
jmp    11e0 <main+0x80>
movl   $0x1,-0x1c(%rbp)
jmp    1204 <main+0xa4>
movl   $0x1,-0x18(%rbp)
jmp    1204 <main+0xa4>
movl   $0x1,-0x20(%rbp)
jmp    1204 <main+0xa4>
jmp    118b <main+0x2b>
cmpl   $0x0,-0x18(%rbp)
je     1222 <main+0xc2>
mov    $0x0,%al
call   1050 <kill_daemon@plt>
mov    %eax,-0x4(%rbp)
jmp    1282 <main+0x122>
cmpl   $0x0,-0x1c(%rbp)
je     123f <main+0xdf>
mov    $0x0,%al
call   1040 <daemonize@plt>
mov    $0x0,%al
call   1030 <setup_radio@plt>
jmp    1276 <main+0x116>
cmpl   $0x0,-0x20(%rbp)
je     125c <main+0xfc>
mov    $0x0,%al
call   1060 <syslog_init@plt>
mov    $0x0,%al
call   1030 <setup_radio@plt>
jmp    1271 <main+0x111>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
lea    0xd98(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1276 <main+0x116>
jmp    127b <main+0x11b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eb0(%rip),%rax
movq   $0x0,(%rax)
lea    0xec2(%rip),%r14
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <getopt@plt>
cmp    $0xffffffff,%eax
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <kill_daemon@plt>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [4 x i8] c"skd\00"
@stderr = global i32 0
@.str.1 = [49 x i8] c"Bad argument: use [-s]tart or [-k]ill not both.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i64 0, i64* @opterr
br label %10
10: ; preds = %21, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %6
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %22
15: ; preds = %10
%16 = load i32, i32* %6
switch i32 %16, label %20 [
i32 115, label %17
i32 107, label %18
i32 100, label %19
]
17: ; preds = %15
store i32 1, i32* %8
br label %21
18: ; preds = %15
store i32 1, i32* %7
br label %21
19: ; preds = %15
store i32 1, i32* %9
br label %20
20: ; preds = %15, %19
br label %21
21: ; preds = %20, %18, %17
br label %10
22: ; preds = %10
%23 = load i32, i32* %7
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (...) @kill_daemon()
store i32 %26, i32* %3
br label %45
27: ; preds = %22
%28 = load i32, i32* %8
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = call i32 (...) @daemonize()
%32 = call i32 (...) @setup_radio()
br label %43
33: ; preds = %27
%34 = load i32, i32* %9
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = call i32 (...) @syslog_init()
%38 = call i32 (...) @setup_radio()
br label %42
39: ; preds = %33
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %42
42: ; preds = %39, %36
br label %43
43: ; preds = %42, %30
br label %44
44: ; preds = %43
store i32 0, i32* %3
br label %45
45: ; preds = %44, %25
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [4 x i8] c"skd\00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** %1) {
store i64 0, i64* @opterr
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %3
6: ; preds = %3
%7 = tail call i32 (...) @kill_daemon()
ret i32 %7
}