#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int we_wordc;
  char **we_wordv;
};
typedef TYPE_1__ wordexp_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int wordexp(char const *, TYPE_1__ *, int /*<<< orphan*/);
void command_line_test(const char *words) {
  wordexp_t we;
  int i;
  int retval = wordexp(words, &we, 0);
  printf("wordexp returned %d\n", retval);
  for (i = 0; i < we.we_wordc; i++)
    printf("we_wordv[%d] = \"%s\"\n", i, we.we_wordv[i]);
}


x86 assembly (clang, -O0):
<command_line_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1040 <wordexp@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    118d <command_line_test+0x6d>
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1156 <command_line_test+0x36>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<command_line_test>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1040 <wordexp@plt>
lea    0xec6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0x8(%rsp)
jle    1183 <command_line_test+0x63>
lea    0xec4(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp),%rax
mov    (%rax,%rbx,8),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1160 <command_line_test+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i8** }
@.str = [21 x i8] c"wordexp returned %d\0A\00"
@.str.1 = [21 x i8] c"we_wordv[%d] = \22%s\22\0A\00"
define void @command_line_test(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.TYPE_3__
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @wordexp(i8* %6, %struct.TYPE_3__* %3, i32 0)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 0, i32* %4
br label %10
10: ; preds = %24, %1
%11 = load i32, i32* %4
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%13 = load i32, i32* %12
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %27
15: ; preds = %10
%16 = load i32, i32* %4
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
%18 = load i8**, i8*** %17
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %22)
br label %24
24: ; preds = %15
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %10
27: ; preds = %10
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i8** }
@.str = [21 x i8] c"wordexp returned %d\0A\00"
@.str.1 = [21 x i8] c"we_wordv[%d] = \22%s\22\0A\00"
define void @command_line_test(i8* %0) {
%2 = alloca %struct.TYPE_3__
%3 = bitcast %struct.TYPE_3__* %2 to i8*
%4 = call i32 @wordexp(i8* %0, %struct.TYPE_3__* %2, i32 0)
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %1
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i64 0, i32 1
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %18, %11 ]
%13 = load i8**, i8*** %10
%14 = getelementptr inbounds i8*, i8** %13, i64 %12
%15 = load i8*, i8** %14
%16 = trunc i64 %12 to i32
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %15)
%18 = add nuw nsw i64 %12, 1
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %11, label %22
22: ; preds = %11, %1
ret void
}