#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*/ printf(char const *, int);
int slibcpy(char **, char const *, int /*<<< orphan*/, int);
int paramstrarr(char **sout, int *outidx, int maxnum, char const *sin,
                char const *errmsg) {
  if (*outidx >= maxnum) {
    printf(errmsg, maxnum);
    return -3;
  }
  return slibcpy(&sout[(*outidx)++], sin, 0, -3);
}


x86 assembly (clang, -O0):
<paramstrarr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cmp    -0x1c(%rbp),%eax
jl     1162 <paramstrarr+0x42>
mov    -0x30(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    118f <paramstrarr+0x6f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    (%rcx),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,(%rcx)
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rsi
xor    %edx,%edx
mov    $0xfffffffd,%ecx
call   1030 <slibcpy@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paramstrarr>:
push   %rax
movslq (%rsi),%rax
cmp    %edx,%eax
jge    1141 <paramstrarr+0x21>
lea    0x1(%rax),%edx
mov    %edx,(%rsi)
lea    (%rdi,%rax,8),%rdi
mov    %rcx,%rsi
xor    %edx,%edx
mov    $0xfffffffd,%ecx
pop    %rax
jmp    1030 <slibcpy@plt>
mov    %r8,%rdi
mov    %edx,%esi
call   1040 <printf@plt>
mov    $0xfffffffd,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @paramstrarr(i8** %0, i32* %1, i32 %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
store i8** %0, i8*** %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i8* %4, i8** %11
%12 = load i32*, i32** %8
%13 = load i32, i32* %12
%14 = load i32, i32* %9
%15 = icmp sge i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %5
%17 = load i8*, i8** %11
%18 = load i32, i32* %9
%19 = call i32 @printf(i8* %17, i32 %18)
store i32 -3, i32* %6
br label %29
20: ; preds = %5
%21 = load i8**, i8*** %7
%22 = load i32*, i32** %8
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
%25 = sext i32 %23 to i64
%26 = getelementptr inbounds i8*, i8** %21, i64 %25
%27 = load i8*, i8** %10
%28 = call i32 @slibcpy(i8** %26, i8* %27, i32 0, i32 -3)
store i32 %28, i32* %6
br label %29
29: ; preds = %20, %16
%30 = load i32, i32* %6
ret i32 %30
}

LLVM IR (-O2):
define i32 @paramstrarr(i8** %0, i32* nocapture %1, i32 %2, i8* %3, i8* %4) {
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, %2
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @printf(i8* %4, i32 %2)
br label %15
10: ; preds = %5
%11 = add nsw i32 %6, 1
store i32 %11, i32* %1
%12 = sext i32 %6 to i64
%13 = getelementptr inbounds i8*, i8** %0, i64 %12
%14 = tail call i32 @slibcpy(i8** %13, i8* %3, i32 0, i32 -3)
br label %15
15: ; preds = %10, %8
%16 = phi i32 [ -3, %8 ], [ %14, %10 ]
ret i32 %16
}