#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int pl_String(void *variable, int argc, char *argv[], int i, int k) {
  if (i < argc) {
    *(char **)variable = &argv[i][k];
    return (i + 1);
  } else {
    fprintf(stderr, "The command line is missing a ");
    fprintf(stderr, "string of characters at its end\n\n");
    return (0);
  }
}


x86 assembly (clang, -O0):
<pl_String>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115e <pl_String+0x4e>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
movslq -0x28(%rbp),%rax
add    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    118f <pl_String+0x7f>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl_String>:
push   %rbx
cmp    %esi,%ecx
jge    1129 <pl_String+0x19>
mov    %ecx,%eax
movslq %ecx,%rcx
movslq %r8d,%rsi
add    (%rdx,%rcx,8),%rsi
mov    %rsi,(%rdi)
add    $0x1,%eax
pop    %rbx
ret
mov    0x2eb0(%rip),%rbx
mov    (%rbx),%edi
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed8(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"The command line is missing a \00"
@.str.1 = [34 x i8] c"string of characters at its end\0A\0A\00"
define i32 @pl_String(i8* %0, i32 %1, i8** %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8** %2, i8*** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%12 = load i32, i32* %10
%13 = load i32, i32* %8
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %28
15: ; preds = %5
%16 = load i8**, i8*** %9
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = load i32, i32* %11
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8*, i8** %7
%25 = bitcast i8* %24 to i8**
store i8* %23, i8** %25
%26 = load i32, i32* %10
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %33
28: ; preds = %5
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %33
33: ; preds = %28, %15
%34 = load i32, i32* %6
ret i32 %34
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"The command line is missing a \00"
@.str.1 = [34 x i8] c"string of characters at its end\0A\0A\00"
define i32 @pl_String(i8* nocapture writeonly %0, i32 %1, i8** nocapture %2, i32 %3, i32 %4) {
%6 = icmp slt i32 %3, %1
br i1 %6, label %7, label %15
7: ; preds = %5
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i8*, i8** %2, i64 %8
%10 = load i8*, i8** %9
%11 = sext i32 %4 to i64
%12 = getelementptr inbounds i8, i8* %10, i64 %11
%13 = bitcast i8* %0 to i8**
store i8* %12, i8** %13
%14 = add nsw i32 %3, 1
br label %20
15: ; preds = %5
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %15, %7
%21 = phi i32 [ %14, %7 ], [ 0, %15 ]
ret i32 %21
}