#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 */
char *do_parse_arg_tag(int *, int, char const **, int, char *, char const *,
                       char const *);
const char *parse_arg_tag(int *arg, int argc, const char **argv,
                          const char *stag, const char *ltag,
                          const char *vsep) {
  const char *tmp_str = NULL;
  if ((tmp_str = do_parse_arg_tag(arg, argc, argv, 2, "--", ltag, vsep))) {
    return tmp_str;
  } else if ((tmp_str =
                  do_parse_arg_tag(arg, argc, argv, 1, "-", stag, vsep))) {
    return tmp_str;
  } else if ((tmp_str = do_parse_arg_tag(arg, argc, argv, 1, "-", stag, ""))) {
    return tmp_str;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<parse_arg_tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%r9
mov    -0x38(%rbp),%rax
mov    $0x2,%ecx
lea    0xeaa(%rip),%r8
mov    %rax,(%rsp)
call   1030 <do_parse_arg_tag@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     117a <parse_arg_tag+0x6a>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1215 <parse_arg_tag+0x105>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%r9
mov    -0x38(%rbp),%rax
mov    $0x1,%ecx
lea    0xe68(%rip),%r8
mov    %rax,(%rsp)
call   1030 <do_parse_arg_tag@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     11bd <parse_arg_tag+0xad>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1215 <parse_arg_tag+0x105>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%r9
mov    $0x1,%ecx
lea    0xe29(%rip),%r8
lea    0xe23(%rip),%rax
mov    %rax,(%rsp)
call   1030 <do_parse_arg_tag@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     1203 <parse_arg_tag+0xf3>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1215 <parse_arg_tag+0x105>
jmp    1208 <parse_arg_tag+0xf8>
jmp    120d <parse_arg_tag+0xfd>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_arg_tag>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r9,%rbp
mov    %r8,%r9
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%r12d
mov    %rdi,%rbx
mov    %rbp,(%rsp)
lea    0xec7(%rip),%r8
mov    $0x2,%ecx
call   1030 <do_parse_arg_tag@plt>
test   %rax,%rax
jne    1196 <parse_arg_tag+0x86>
mov    %rbp,(%rsp)
lea    0xeae(%rip),%r8
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15,%rdx
mov    $0x1,%ecx
mov    %r14,%r9
call   1030 <do_parse_arg_tag@plt>
test   %rax,%rax
jne    1196 <parse_arg_tag+0x86>
lea    0xe8d(%rip),%rax
mov    %rax,(%rsp)
lea    0xe81(%rip),%r8
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15,%rdx
mov    $0x1,%ecx
mov    %r14,%r9
call   1030 <do_parse_arg_tag@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"--\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [1 x i8] zeroinitializer
define i8* @parse_arg_tag(i32* %0, i32 %1, i8** %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8**
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
store i32* %0, i32** %8
store i32 %1, i32* %9
store i8** %2, i8*** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i8* null, i8** %14
%15 = load i32*, i32** %8
%16 = load i32, i32* %9
%17 = load i8**, i8*** %10
%18 = load i8*, i8** %12
%19 = load i8*, i8** %13
%20 = call i8* @do_parse_arg_tag(i32* %15, i32 %16, i8** %17, i32 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %19)
store i8* %20, i8** %14
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %24
22: ; preds = %6
%23 = load i8*, i8** %14
store i8* %23, i8** %7
br label %46
24: ; preds = %6
%25 = load i32*, i32** %8
%26 = load i32, i32* %9
%27 = load i8**, i8*** %10
%28 = load i8*, i8** %11
%29 = load i8*, i8** %13
%30 = call i8* @do_parse_arg_tag(i32* %25, i32 %26, i8** %27, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %28, i8* %29)
store i8* %30, i8** %14
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = load i8*, i8** %14
store i8* %33, i8** %7
br label %46
34: ; preds = %24
%35 = load i32*, i32** %8
%36 = load i32, i32* %9
%37 = load i8**, i8*** %10
%38 = load i8*, i8** %11
%39 = call i8* @do_parse_arg_tag(i32* %35, i32 %36, i8** %37, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %38, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
store i8* %39, i8** %14
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %43
41: ; preds = %34
%42 = load i8*, i8** %14
store i8* %42, i8** %7
br label %46
43: ; preds = %34
br label %44
44: ; preds = %43
br label %45
45: ; preds = %44
store i8* null, i8** %7
br label %46
46: ; preds = %45, %41, %32, %22
%47 = load i8*, i8** %7
ret i8* %47
}

LLVM IR (-O2):
@.str = [3 x i8] c"--\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [1 x i8] zeroinitializer
define i8* @parse_arg_tag(i32* %0, i32 %1, i8** %2, i8* %3, i8* %4, i8* %5) {
%7 = tail call i8* @do_parse_arg_tag(i32* %0, i32 %1, i8** %2, i32 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %5)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = tail call i8* @do_parse_arg_tag(i32* %0, i32 %1, i8** %2, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %5)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i8* @do_parse_arg_tag(i32* %0, i32 %1, i8** %2, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %9, %6
%15 = phi i8* [ %7, %6 ], [ %10, %9 ], [ %13, %12 ]
ret i8* %15
}