#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*/ uint32_t;
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ start_cmd_close(int /*<<< orphan*/);
int /*<<< orphan*/ start_cmd_file(int /*<<< orphan*/);
int /*<<< orphan*/ start_cmd_help(int /*<<< orphan*/);
int /*<<< orphan*/ start_cmd_ip_addr(int /*<<< orphan*/);
int /*<<< orphan*/ start_cmd_port(int /*<<< orphan*/);
int /*<<< orphan*/ start_cmd_test(int /*<<< orphan*/);
int /*<<< orphan*/ start_cmd_version(int /*<<< orphan*/);
int /*<<< orphan*/ strncat(char *, char *, int);
uint32_t pof_set_init_config_by_command(int argc, char *argv[]) {
  uint32_t ret = 0;
  char optstring[(50)];
  struct option long_options[] = {
      {"ip-addr", 0, NULL, 'i'}, {"port", 0, NULL, 'p'},
      {"file", 0, NULL, 'f'},    {"test", 0, NULL, 't'},
      {"help", 0, NULL, 'h'},    {"close", 0, NULL, 'c'},
      {"version", 0, NULL, 'v'}, {NULL, 0, NULL, 0}};
  int ch;
  strncat(optstring, "i:", (30));
  strncat(optstring, "p:", (30));
  strncat(optstring, "f:", (30));
  strncat(optstring, "t", (30));
  strncat(optstring, "h", (30));
  strncat(optstring, "c", (30));
  strncat(optstring, "v", (30));
  while ((ch = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) {
    switch (ch) {
    case '?':
      exit(0);
      break;
    case 'i':
      start_cmd_ip_addr(optarg);
      break;
    case 'p':
      start_cmd_port(optarg);
      break;
    case 'f':
      start_cmd_file(optarg);
      break;
    case 't':
      start_cmd_test(optarg);
      break;
    case 'h':
      start_cmd_help(optarg);
      break;
    case 'c':
      start_cmd_close(optarg);
      break;
    case 'v':
      start_cmd_version(optarg);
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<pof_set_init_config_by_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x150(%rbp),%rdi
lea    0x2b39(%rip),%rsi
mov    $0x100,%edx
call   1070 <memcpy@plt>
lea    -0x50(%rbp),%rdi
lea    0xf1e(%rip),%rsi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    -0x50(%rbp),%rdi
lea    0xf0c(%rip),%rsi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    -0x50(%rbp),%rdi
lea    0xefa(%rip),%rsi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    -0x50(%rbp),%rdi
lea    0xec0(%rip),%rsi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    -0x50(%rbp),%rdi
lea    0xed3(%rip),%rsi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    -0x50(%rbp),%rdi
lea    0xec0(%rip),%rsi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    -0x50(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x1e,%edx
call   1050 <strncat@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x150(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <getopt_long@plt>
mov    %eax,-0x154(%rbp)
cmp    $0xffffffff,%eax
je     1367 <pof_set_init_config_by_command+0x1b7>
mov    -0x154(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x160(%rbp)
sub    $0x37,%eax
ja     135d <pof_set_init_config_by_command+0x1ad>
mov    -0x160(%rbp),%rax
lea    0xd38(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %edi,%edi
call   10c0 <exit@plt>
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
call   1030 <start_cmd_ip_addr@plt>
jmp    1362 <pof_set_init_config_by_command+0x1b2>
mov    0x2cfe(%rip),%rax
mov    (%rax),%edi
call   1060 <start_cmd_port@plt>
jmp    1362 <pof_set_init_config_by_command+0x1b2>
mov    0x2ceb(%rip),%rax
mov    (%rax),%edi
call   1090 <start_cmd_file@plt>
jmp    1362 <pof_set_init_config_by_command+0x1b2>
mov    0x2cd8(%rip),%rax
mov    (%rax),%edi
call   10b0 <start_cmd_test@plt>
jmp    1362 <pof_set_init_config_by_command+0x1b2>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
call   10a0 <start_cmd_help@plt>
jmp    1362 <pof_set_init_config_by_command+0x1b2>
mov    0x2cb2(%rip),%rax
mov    (%rax),%edi
call   1080 <start_cmd_close@plt>
jmp    1362 <pof_set_init_config_by_command+0x1b2>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edi
call   10d0 <start_cmd_version@plt>
jmp    1362 <pof_set_init_config_by_command+0x1b2>
jmp    1362 <pof_set_init_config_by_command+0x1b2>
jmp    1274 <pof_set_init_config_by_command+0xc4>
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pof_set_init_config_by_command>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rsi,%r12
mov    %edi,%ebp
lea    0x2b43(%rip),%rsi
lea    0x40(%rsp),%r14
mov    $0x100,%edx
mov    %r14,%rdi
call   1070 <memcpy@plt>
lea    0xf24(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    0xf10(%rip),%rsi
mov    %r15,%rdi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    0xeff(%rip),%rsi
mov    %r15,%rdi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    0xec6(%rip),%rsi
mov    %r15,%rdi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    0xeda(%rip),%rsi
mov    %r15,%rdi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    0xec8(%rip),%rsi
mov    %r15,%rdi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    0xeb6(%rip),%rsi
mov    %r15,%rdi
mov    $0x1e,%edx
call   1050 <strncat@plt>
lea    0xd8b(%rip),%rbx
mov    0x2d74(%rip),%r13
jmp    1290 <pof_set_init_config_by_command+0xe0>
mov    0x0(%r13),%edi
call   10d0 <start_cmd_version@plt>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x37,%ecx
ja     12f6 <pof_set_init_config_by_command+0x146>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    0x0(%r13),%edi
call   1080 <start_cmd_close@plt>
jmp    1290 <pof_set_init_config_by_command+0xe0>
mov    0x0(%r13),%edi
call   1090 <start_cmd_file@plt>
jmp    1290 <pof_set_init_config_by_command+0xe0>
mov    0x0(%r13),%edi
call   10a0 <start_cmd_help@plt>
jmp    1290 <pof_set_init_config_by_command+0xe0>
mov    0x0(%r13),%edi
call   1030 <start_cmd_ip_addr@plt>
jmp    1290 <pof_set_init_config_by_command+0xe0>
mov    0x0(%r13),%edi
call   1060 <start_cmd_port@plt>
jmp    1290 <pof_set_init_config_by_command+0xe0>
mov    0x0(%r13),%edi
call   10b0 <start_cmd_test@plt>
jmp    1290 <pof_set_init_config_by_command+0xe0>
cmp    $0xffffffff,%eax
jne    1290 <pof_set_init_config_by_command+0xe0>
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [8 x i8] c"ip-addr\00"
@.str.1 = [5 x i8] c"port\00"
@.str.2 = [5 x i8] c"file\00"
@.str.3 = [5 x i8] c"test\00"
@.str.4 = [5 x i8] c"help\00"
@.str.5 = [6 x i8] c"close\00"
@.str.6 = [8 x i8] c"version\00"
@__const.pof_set_init_config_by_command.long_options = [8 x %struct.option] [%struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8 0, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8 0, i32* null, i32 112 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 0, i32* null, i32 102 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8 0, i32* null, i32 116 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8 0, i32* null, i32 104 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8 0, i32* null, i32 99 }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8 0, i32* null, i32 118 }, %struct.option zeroinitializer]
@.str.7 = [3 x i8] c"i:\00"
@.str.8 = [3 x i8] c"p:\00"
@.str.9 = [3 x i8] c"f:\00"
@.str.10 = [2 x i8] c"t\00"
@.str.11 = [2 x i8] c"h\00"
@.str.12 = [2 x i8] c"c\00"
@.str.13 = [2 x i8] c"v\00"
@optarg = global i32 0
define i32 @pof_set_init_config_by_command(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [50 x i8]
%8 = alloca [8 x %struct.option]
%9 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%10 = bitcast [8 x %struct.option]* %8 to i8*
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%12 = call i32 @strncat(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 30)
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%14 = call i32 @strncat(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 30)
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%16 = call i32 @strncat(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 30)
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%18 = call i32 @strncat(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 30)
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%20 = call i32 @strncat(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i32 30)
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%22 = call i32 @strncat(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 30)
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%24 = call i32 @strncat(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 30)
br label %25
25: ; preds = %58, %2
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%29 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %8, i64 0, i64 0
%30 = call i32 @getopt_long(i32 %26, i8** %27, i8* %28, %struct.option* %29, i32* null)
store i32 %30, i32* %9
%31 = icmp ne i32 %30, -1
br i1 %31, label %32, label %59
32: ; preds = %25
%33 = load i32, i32* %9
switch i32 %33, label %57 [
i32 63, label %34
i32 105, label %36
i32 112, label %39
i32 102, label %42
i32 116, label %45
i32 104, label %48
i32 99, label %51
i32 118, label %54
]
34: ; preds = %32
%35 = call i32 @exit(i32 0)
unreachable
36: ; preds = %32
%37 = load i32, i32* @optarg
%38 = call i32 @start_cmd_ip_addr(i32 %37)
br label %58
39: ; preds = %32
%40 = load i32, i32* @optarg
%41 = call i32 @start_cmd_port(i32 %40)
br label %58
42: ; preds = %32
%43 = load i32, i32* @optarg
%44 = call i32 @start_cmd_file(i32 %43)
br label %58
45: ; preds = %32
%46 = load i32, i32* @optarg
%47 = call i32 @start_cmd_test(i32 %46)
br label %58
48: ; preds = %32
%49 = load i32, i32* @optarg
%50 = call i32 @start_cmd_help(i32 %49)
br label %58
51: ; preds = %32
%52 = load i32, i32* @optarg
%53 = call i32 @start_cmd_close(i32 %52)
br label %58
54: ; preds = %32
%55 = load i32, i32* @optarg
%56 = call i32 @start_cmd_version(i32 %55)
br label %58
57: ; preds = %32
br label %58
58: ; preds = %57, %54, %51, %48, %45, %42, %39, %36
br label %25
59: ; preds = %25
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [8 x i8] c"ip-addr\00"
@.str.1 = [5 x i8] c"port\00"
@.str.2 = [5 x i8] c"file\00"
@.str.3 = [5 x i8] c"test\00"
@.str.4 = [5 x i8] c"help\00"
@.str.5 = [6 x i8] c"close\00"
@.str.6 = [8 x i8] c"version\00"
@__const.pof_set_init_config_by_command.long_options = [8 x %struct.option] [%struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8 0, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8 0, i32* null, i32 112 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 0, i32* null, i32 102 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8 0, i32* null, i32 116 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8 0, i32* null, i32 104 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8 0, i32* null, i32 99 }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8 0, i32* null, i32 118 }, %struct.option zeroinitializer]
@.str.7 = [3 x i8] c"i:\00"
@.str.8 = [3 x i8] c"p:\00"
@.str.9 = [3 x i8] c"f:\00"
@.str.10 = [2 x i8] c"t\00"
@.str.11 = [2 x i8] c"h\00"
@.str.12 = [2 x i8] c"c\00"
@.str.13 = [2 x i8] c"v\00"
@optarg = global i32 0
define i32 @pof_set_init_config_by_command(i32 %0, i8** %1) {
%3 = alloca [50 x i8]
%4 = alloca [8 x %struct.option]
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%6 = bitcast [8 x %struct.option]* %4 to i8*
%7 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 30)
%8 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 30)
%9 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 30)
%10 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 30)
%11 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i32 30)
%12 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 30)
%13 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 30)
%14 = getelementptr inbounds [8 x %struct.option], [8 x %struct.option]* %4, i64 0, i64 0
br label %15
15: ; preds = %17, %2
%16 = call i32 @getopt_long(i32 %0, i8** %1, i8* %5, %struct.option* %14, i32* null)
switch i32 %16, label %17 [
i32 -1, label %41
i32 63, label %18
i32 105, label %20
i32 112, label %23
i32 102, label %26
i32 116, label %29
i32 104, label %32
i32 99, label %35
i32 118, label %38
]
17: ; preds = %15, %38, %35, %32, %29, %26, %23, %20
br label %15
18: ; preds = %15
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %15
%21 = load i32, i32* @optarg
%22 = call i32 @start_cmd_ip_addr(i32 %21)
br label %17
23: ; preds = %15
%24 = load i32, i32* @optarg
%25 = call i32 @start_cmd_port(i32 %24)
br label %17
26: ; preds = %15
%27 = load i32, i32* @optarg
%28 = call i32 @start_cmd_file(i32 %27)
br label %17
29: ; preds = %15
%30 = load i32, i32* @optarg
%31 = call i32 @start_cmd_test(i32 %30)
br label %17
32: ; preds = %15
%33 = load i32, i32* @optarg
%34 = call i32 @start_cmd_help(i32 %33)
br label %17
35: ; preds = %15
%36 = load i32, i32* @optarg
%37 = call i32 @start_cmd_close(i32 %36)
br label %17
38: ; preds = %15
%39 = load i32, i32* @optarg
%40 = call i32 @start_cmd_version(i32 %39)
br label %17
41: ; preds = %15
ret i32 undef
}