#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 **create_argv_new(char *, int *, char *);
int /*<<< orphan*/ free(char *);
char *get_list_as_string(int, char **, char *, int /*<<< orphan*/ *,
                         int /*<<< orphan*/ *, int *);
char **get_list_from_argv(int argc, char **argv, char *tag, int *nfound,
                          int *found_list) {
  char *myptr = get_list_as_string(argc, argv, tag, NULL, NULL, found_list);
  if (myptr == NULL) {
    *nfound = 0;
    return NULL;
  }
  char **myargv = create_argv_new(myptr, nfound, " \n");
  free(myptr);
  return myargv;
}


x86 assembly (clang, -O0):
<get_list_from_argv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%r9
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
call   1050 <get_list_as_string@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    118d <get_list_from_argv+0x5d>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    11b6 <get_list_from_argv+0x86>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    0xe64(%rip),%rdx
call   1040 <create_argv_new@plt>
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_list_from_argv>:
push   %r14
push   %rbx
push   %rax
mov    %r8,%r9
mov    %rcx,%r14
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <get_list_as_string@plt>
test   %rax,%rax
je     116e <get_list_from_argv+0x3e>
mov    %rax,%rbx
lea    0xead(%rip),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <create_argv_new@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
jmp    1177 <get_list_from_argv+0x47>
movl   $0x0,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \0A\00"
define i8** @get_list_from_argv(i32 %0, i8** %1, i8* %2, i32* %3, i32* %4) {
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i8**
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i8* %2, i8** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
%14 = load i32, i32* %7
%15 = load i8**, i8*** %8
%16 = load i8*, i8** %9
%17 = load i32*, i32** %11
%18 = call i8* @get_list_as_string(i32 %14, i8** %15, i8* %16, i32* null, i32* null, i32* %17)
store i8* %18, i8** %12
%19 = load i8*, i8** %12
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %23
21: ; preds = %5
%22 = load i32*, i32** %10
store i32 0, i32* %22
store i8** null, i8*** %6
br label %30
23: ; preds = %5
%24 = load i8*, i8** %12
%25 = load i32*, i32** %10
%26 = call i8** @create_argv_new(i8* %24, i32* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8** %26, i8*** %13
%27 = load i8*, i8** %12
%28 = call i32 @free(i8* %27)
%29 = load i8**, i8*** %13
store i8** %29, i8*** %6
br label %30
30: ; preds = %23, %21
%31 = load i8**, i8*** %6
ret i8** %31
}

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