#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*/ LOG_WARNING;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ optopt;
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ smbftpd_help_print();
char *strdup(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void smbftpd_parse_args(int argc, char *argv[], char **conf, int *daemon_mode) {
  int ch;
  while ((ch = getopt(argc, argv, "Ds:vh")) != -1) {
    switch (ch) {
    case 'D':
      *daemon_mode = 1;
      break;
    case 's':
      *conf = strdup(optarg);
      break;
    case 'v':
      printf("%s\n", "SmbFTPD Ver 2.2");
      exit(0);
      break;
    case 'h':
      smbftpd_help_print();
      exit(0);
    default:
      syslog(LOG_WARNING, "unknown flag -%c ignored", optopt);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<smbftpd_parse_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe7b(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     1254 <smbftpd_parse_args+0xf4>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x44,%eax
je     11dd <smbftpd_parse_args+0x7d>
jmp    11aa <smbftpd_parse_args+0x4a>
mov    -0x28(%rbp),%eax
sub    $0x68,%eax
je     1223 <smbftpd_parse_args+0xc3>
jmp    11bb <smbftpd_parse_args+0x5b>
mov    -0x28(%rbp),%eax
sub    $0x73,%eax
je     11ec <smbftpd_parse_args+0x8c>
jmp    11cc <smbftpd_parse_args+0x6c>
mov    -0x28(%rbp),%eax
sub    $0x76,%eax
je     1209 <smbftpd_parse_args+0xa9>
jmp    1231 <smbftpd_parse_args+0xd1>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
jmp    124f <smbftpd_parse_args+0xef>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
call   1080 <strdup@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    124f <smbftpd_parse_args+0xef>
lea    0xdf6(%rip),%rdi
lea    0xdf3(%rip),%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    $0x0,%al
call   1040 <smbftpd_help_print@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
mov    0x2d9f(%rip),%rax
mov    (%rax),%edx
lea    0xdd0(%rip),%rsi
call   1050 <syslog@plt>
jmp    1177 <smbftpd_parse_args+0x17>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smbftpd_parse_args>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe83(%rip),%r12
mov    0x2e74(%rip),%r13
jmp    119c <smbftpd_parse_args+0x3c>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x44,%eax
jne    11c1 <smbftpd_parse_args+0x61>
movl   $0x1,(%r14)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1060 <getopt@plt>
cmp    $0x67,%eax
jle    1190 <smbftpd_parse_args+0x30>
cmp    $0x73,%eax
jne    11c8 <smbftpd_parse_args+0x68>
mov    0x0(%r13),%edi
call   1080 <strdup@plt>
mov    %rax,(%r15)
jmp    119c <smbftpd_parse_args+0x3c>
cmp    $0xffffffff,%eax
jne    11d2 <smbftpd_parse_args+0x72>
jmp    11f2 <smbftpd_parse_args+0x92>
cmp    $0x68,%eax
je     1201 <smbftpd_parse_args+0xa1>
cmp    $0x76,%eax
je     120f <smbftpd_parse_args+0xaf>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
mov    0x2dfe(%rip),%rax
mov    (%rax),%edx
lea    0xe2f(%rip),%rsi
call   1050 <syslog@plt>
jmp    119c <smbftpd_parse_args+0x3c>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1040 <smbftpd_help_print@plt>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xdf0(%rip),%rdi
lea    0xded(%rip),%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Ds:vh\00"
@optarg = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [16 x i8] c"SmbFTPD Ver 2.2\00"
@LOG_WARNING = global i32 0
@.str.3 = [25 x i8] c"unknown flag -%c ignored\00"
@optopt = global i32 0
define void @smbftpd_parse_args(i32 %0, i8** %1, i8** %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32* %3, i32** %8
br label %10
10: ; preds = %33, %4
%11 = load i32, i32* %5
%12 = load i8**, i8*** %6
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %9
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %34
15: ; preds = %10
%16 = load i32, i32* %9
switch i32 %16, label %29 [
i32 68, label %17
i32 115, label %19
i32 118, label %23
i32 104, label %26
]
17: ; preds = %15
%18 = load i32*, i32** %8
store i32 1, i32* %18
br label %33
19: ; preds = %15
%20 = load i32, i32* @optarg
%21 = call i8* @strdup(i32 %20)
%22 = load i8**, i8*** %7
store i8* %21, i8** %22
br label %33
23: ; preds = %15
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %15
%27 = call i32 (...) @smbftpd_help_print()
%28 = call i32 @exit(i32 0)
unreachable
29: ; preds = %15
%30 = load i32, i32* @LOG_WARNING
%31 = load i32, i32* @optopt
%32 = call i32 @syslog(i32 %30, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %29, %19, %17
br label %10
34: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Ds:vh\00"
@optarg = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [16 x i8] c"SmbFTPD Ver 2.2\00"
@LOG_WARNING = global i32 0
@.str.3 = [25 x i8] c"unknown flag -%c ignored\00"
@optopt = global i32 0
define void @smbftpd_parse_args(i32 %0, i8** %1, i8** nocapture writeonly %2, i32* nocapture writeonly %3) {
br label %5
5: ; preds = %21, %4
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %17 [
i32 -1, label %22
i32 68, label %7
i32 115, label %8
i32 118, label %11
i32 104, label %14
]
7: ; preds = %5
store i32 1, i32* %3
br label %21
8: ; preds = %5
%9 = load i32, i32* @optarg
%10 = tail call i8* @strdup(i32 %9)
store i8* %10, i8** %2
br label %21
11: ; preds = %5
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @exit(i32 0)
unreachable
14: ; preds = %5
%15 = tail call i32 (...) @smbftpd_help_print()
%16 = tail call i32 @exit(i32 0)
unreachable
17: ; preds = %5
%18 = load i32, i32* @LOG_WARNING
%19 = load i32, i32* @optopt
%20 = tail call i32 @syslog(i32 %18, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %17, %8, %7
br label %5
22: ; preds = %5
ret void
}