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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt_long(int, char **, char *, struct option *, int *);
char *malloc(int);
int /*<<< orphan*/ optarg;
int optind;
#define optional_argument 129
int /*<<< orphan*/ printf(char *);
#define required_argument 128
int strlen(int /*<<< orphan*/);
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int);
int parse_args(int argc, char *argv[], char **vs_name, char **topo_name) {
  int choice;
  while (1) {
    static struct option long_options[] = {
        {"help", optional_argument, 0, 'h'},
        {"input", required_argument, 0, 'i'},
        {"output", required_argument, 0, 'o'},
        {0, 0, 0, 0}};
    int option_index = 0;
    choice = getopt_long(argc, argv, "h::i:o:", long_options, &option_index);
    if (choice == -1)
      break;
    switch (choice) {
    case 'v':
      break;
    case 'i':
      *vs_name = malloc(strlen(optarg) * sizeof(char));
      strncpy(*vs_name, optarg, strlen(optarg));
      break;
    case 'o':
      *topo_name = malloc(strlen(optarg) * sizeof(char));
      strncpy(*topo_name, optarg, strlen(optarg));
      break;
    case 'h':
    case '?':
    default:
      printf("Usage: ./bin/create_ascii_bathy_from_sep_vs "
             "-i [input_sep_header.H] -o [output_bathy.txt]\n");
      exit(EXIT_FAILURE);
    }
  }
  if (optind < argc) {
    while (optind < argc) {
      continue;
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<parse_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe86(%rip),%rdx
lea    0x2ecd(%rip),%rcx
lea    -0x28(%rbp),%r8
call   1050 <getopt_long@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    11ae <parse_args+0x4e>
jmp    12e9 <parse_args+0x189>
mov    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x3f,%eax
je     12c5 <parse_args+0x165>
jmp    11c2 <parse_args+0x62>
mov    -0x2c(%rbp),%eax
sub    $0x68,%eax
je     12c5 <parse_args+0x165>
jmp    11d3 <parse_args+0x73>
mov    -0x2c(%rbp),%eax
sub    $0x69,%eax
je     120b <parse_args+0xab>
jmp    11e4 <parse_args+0x84>
mov    -0x2c(%rbp),%eax
sub    $0x6f,%eax
je     1268 <parse_args+0x108>
jmp    11f5 <parse_args+0x95>
mov    -0x2c(%rbp),%eax
sub    $0x76,%eax
jne    12ca <parse_args+0x16a>
jmp    1206 <parse_args+0xa6>
jmp    12e4 <parse_args+0x184>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
call   1040 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    %eax,%edx
call   1030 <strncpy@plt>
jmp    12e4 <parse_args+0x184>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
call   1040 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    0x2d59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    %eax,%edx
call   1030 <strncpy@plt>
jmp    12e4 <parse_args+0x184>
jmp    12ca <parse_args+0x16a>
lea    0xd49(%rip),%rdi
call   1060 <printf@plt>
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
jmp    1177 <parse_args+0x17>
mov    0x2cf0(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jge    131c <parse_args+0x1bc>
jmp    1300 <parse_args+0x1a0>
mov    0x2cd9(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jge    1317 <parse_args+0x1b7>
jmp    1300 <parse_args+0x1a0>
jmp    131c <parse_args+0x1bc>
mov    0x2ca5(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_args>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
mov    %rdx,0x8(%rsp)
mov    %rsi,%r13
mov    %edi,%r14d
lea    0xe8d(%rip),%rbx
lea    0x2ed4(%rip),%r12
jmp    11cd <parse_args+0x6d>
xchg   %ax,%ax
mov    0x2e61(%rip),%rbp
mov    0x0(%rbp),%edi
call   1050 <strlen@plt>
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rbx,%r15
mov    %rax,%rbx
mov    0x10(%rsp),%rax
mov    %rbx,(%rax)
mov    0x0(%rbp),%ebp
mov    %ebp,%edi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r15,%rbx
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <strncpy@plt>
movl   $0x0,0x4(%rsp)
mov    %r14d,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
lea    0x4(%rsp),%r8
call   1060 <getopt_long@plt>
cmp    $0x6e,%eax
jle    1200 <parse_args+0xa0>
cmp    $0x6f,%eax
je     1190 <parse_args+0x30>
cmp    $0x76,%eax
je     11cd <parse_args+0x6d>
jmp    1262 <parse_args+0x102>
nopl   0x0(%rax)
cmp    $0x69,%eax
jne    1245 <parse_args+0xe5>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
call   1050 <strlen@plt>
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    0x8(%rsp),%rax
mov    %r15,(%rax)
mov    %r12,%rbp
mov    0x2dc9(%rip),%rax
mov    (%rax),%r12d
mov    %r12d,%edi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %rbp,%r12
jmp    11c6 <parse_args+0x66>
cmp    $0xffffffff,%eax
jne    1262 <parse_args+0x102>
mov    0x2d7f(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdb1(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@parse_args.long_options = internal global [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 -127, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8 -128, i32 0, i32 105 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32 0, i32 111 }, %struct.option zeroinitializer]
@.str = [5 x i8] c"help\00"
@.str.1 = [6 x i8] c"input\00"
@.str.2 = [7 x i8] c"output\00"
@.str.3 = [8 x i8] c"h::i:o:\00"
@optarg = global i32 0
@.str.4 = [91 x i8] c"Usage: ./bin/create_ascii_bathy_from_sep_vs -i [input_sep_header.H] -o [output_bathy.txt]\0A\00"
@EXIT_FAILURE = global i32 0
@optind = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @parse_args(i32 %0, i8** %1, i8** %2, i8** %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
br label %11
11: ; preds = %4, %54
store i32 0, i32* %10
%12 = load i32, i32* %5
%13 = load i8**, i8*** %6
%14 = call i32 @getopt_long(i32 %12, i8** %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %struct.option* getelementptr inbounds ([4 x %struct.option], [4 x %struct.option]* @parse_args.long_options, i64 0, i64 0), i32* %10)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %18
17: ; preds = %11
br label %55
18: ; preds = %11
%19 = load i32, i32* %9
switch i32 %19, label %50 [
i32 118, label %20
i32 105, label %21
i32 111, label %35
i32 104, label %49
i32 63, label %49
]
20: ; preds = %18
br label %54
21: ; preds = %18
%22 = load i32, i32* @optarg
%23 = call i32 @strlen(i32 %22)
%24 = sext i32 %23 to i64
%25 = mul i64 %24, 1
%26 = trunc i64 %25 to i32
%27 = call i8* @malloc(i32 %26)
%28 = load i8**, i8*** %7
store i8* %27, i8** %28
%29 = load i8**, i8*** %7
%30 = load i8*, i8** %29
%31 = load i32, i32* @optarg
%32 = load i32, i32* @optarg
%33 = call i32 @strlen(i32 %32)
%34 = call i32 @strncpy(i8* %30, i32 %31, i32 %33)
br label %54
35: ; preds = %18
%36 = load i32, i32* @optarg
%37 = call i32 @strlen(i32 %36)
%38 = sext i32 %37 to i64
%39 = mul i64 %38, 1
%40 = trunc i64 %39 to i32
%41 = call i8* @malloc(i32 %40)
%42 = load i8**, i8*** %8
store i8* %41, i8** %42
%43 = load i8**, i8*** %8
%44 = load i8*, i8** %43
%45 = load i32, i32* @optarg
%46 = load i32, i32* @optarg
%47 = call i32 @strlen(i32 %46)
%48 = call i32 @strncpy(i8* %44, i32 %45, i32 %47)
br label %54
49: ; preds = %18, %18
br label %50
50: ; preds = %18, %49
%51 = call i32 @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.4, i64 0, i64 0))
%52 = load i32, i32* @EXIT_FAILURE
%53 = call i32 @exit(i32 %52)
unreachable
54: ; preds = %35, %21, %20
br label %11
55: ; preds = %17
%56 = load i32, i32* @optind
%57 = load i32, i32* %5
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %66
59: ; preds = %55
br label %60
60: ; preds = %64, %59
%61 = load i32, i32* @optind
%62 = load i32, i32* %5
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %65
64: ; preds = %60
br label %60
65: ; preds = %60
br label %66
66: ; preds = %65, %55
%67 = load i32, i32* @EXIT_SUCCESS
ret i32 %67
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@parse_args.long_options = internal global [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 -127, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8 -128, i32 0, i32 105 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32 0, i32 111 }, %struct.option zeroinitializer]
@.str = [5 x i8] c"help\00"
@.str.1 = [6 x i8] c"input\00"
@.str.2 = [7 x i8] c"output\00"
@.str.3 = [8 x i8] c"h::i:o:\00"
@optarg = global i32 0
@EXIT_FAILURE = global i32 0
@optind = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [90 x i8] c"Usage: ./bin/create_ascii_bathy_from_sep_vs -i [input_sep_header.H] -o [output_bathy.txt]\00"
define i32 @parse_args(i32 %0, i8** %1, i8** nocapture writeonly %2, i8** nocapture writeonly %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
br label %7
7: ; preds = %27, %4
store i32 0, i32* %5
%8 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %struct.option* getelementptr inbounds ([4 x %struct.option], [4 x %struct.option]* @parse_args.long_options, i64 0, i64 0), i32* %5)
switch i32 %8, label %23 [
i32 -1, label %28
i32 118, label %27
i32 105, label %9
i32 111, label %16
]
9: ; preds = %7
%10 = load i32, i32* @optarg
%11 = call i32 @strlen(i32 %10)
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %2
%13 = load i32, i32* @optarg
%14 = call i32 @strlen(i32 %13)
%15 = call i32 @strncpy(i8* %12, i32 %13, i32 %14)
br label %27
16: ; preds = %7
%17 = load i32, i32* @optarg
%18 = call i32 @strlen(i32 %17)
%19 = call i8* @malloc(i32 %18)
store i8* %19, i8** %3
%20 = load i32, i32* @optarg
%21 = call i32 @strlen(i32 %20)
%22 = call i32 @strncpy(i8* %19, i32 %20, i32 %21)
br label %27
23: ; preds = %7
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([90 x i8], [90 x i8]* @str, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %9, %16, %7
br label %7
28: ; preds = %7
%29 = load i32, i32* @EXIT_SUCCESS
ret i32 %29
}