#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 */
int /*<<< orphan*/ append_data_to_script(char *, scalar_t__);
int /*<<< orphan*/ free(char *);
char *get_string_argument(char *);
scalar_t__ strlen(char *);
void string_command(int _, char **arguments) {
  char *string;
  for (; *arguments; arguments++) {
    string = get_string_argument(*arguments);
    append_data_to_script(string, strlen(string) + 1);
    free(string);
  }
}


x86 assembly (clang, -O0):
<string_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     11a8 <string_command+0x68>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <get_string_argument@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1050 <append_data_to_script@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    114f <string_command+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_command>:
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%rdi
test   %rdi,%rdi
je     1190 <string_command+0x50>
mov    %rsi,%rbx
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1060 <get_string_argument@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rsi
mov    %r14,%rdi
call   1050 <append_data_to_script@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1160 <string_command+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @string_command(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
br label %6
6: ; preds = %21, %2
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %24
10: ; preds = %6
%11 = load i8**, i8*** %4
%12 = load i8*, i8** %11
%13 = call i8* @get_string_argument(i8* %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = load i8*, i8** %5
%16 = call i64 @strlen(i8* %15)
%17 = add nsw i64 %16, 1
%18 = call i32 @append_data_to_script(i8* %14, i64 %17)
%19 = load i8*, i8** %5
%20 = call i32 @free(i8* %19)
br label %21
21: ; preds = %10
%22 = load i8**, i8*** %4
%23 = getelementptr inbounds i8*, i8** %22, i32 1
store i8** %23, i8*** %4
br label %6
24: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @string_command(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %14, %5 ], [ %3, %2 ]
%7 = phi i8** [ %13, %5 ], [ %1, %2 ]
%8 = tail call i8* @get_string_argument(i8* %6)
%9 = tail call i64 @strlen(i8* dereferenceable(1) %8)
%10 = add nsw i64 %9, 1
%11 = tail call i32 @append_data_to_script(i8* %8, i64 %10)
%12 = tail call i32 @free(i8* %8)
%13 = getelementptr inbounds i8*, i8** %7, i64 1
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %5
16: ; preds = %5, %2
ret void
}