#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 *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ usage(char *);
bool parse_cli(char *string_out, char *substr_out, int argv, char *argc[]) {
  if (argv == 3) {
    strncpy(string_out, argc[1], 128);
    strncpy(substr_out, argc[2], 128);
    return true;
  } else {
    fprintf(stderr, "ERROR: '%s' must have a string as argument.. Exiting\n",
            argc[0]);
    usage(argc[0]);
    return false;
  }
}


x86 assembly (clang, -O0):
<parse_cli>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jne    1189 <parse_cli+0x59>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x80,%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0x80,%edx
call   1030 <strncpy@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b8 <parse_cli+0x88>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    (%rax),%rdx
lea    0xe60(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_cli>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
cmp    $0x3,%edx
jne    1165 <parse_cli+0x35>
mov    %rsi,%r14
mov    0x8(%rbx),%rsi
mov    $0x80,%edx
call   1030 <strncpy@plt>
mov    0x10(%rbx),%rsi
mov    %r14,%rdi
mov    $0x80,%edx
call   1030 <strncpy@plt>
mov    $0x1,%eax
jmp    1187 <parse_cli+0x57>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%rdi
call   1050 <usage@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"ERROR: '%s' must have a string as argument.. Exiting\0A\00"
define i32 @parse_cli(i8* %0, i8* %1, i32 %2, i8** %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8**
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
%10 = load i32, i32* %8
%11 = icmp eq i32 %10, 3
br i1 %11, label %12, label %23
12: ; preds = %4
%13 = load i8*, i8** %6
%14 = load i8**, i8*** %9
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strncpy(i8* %13, i8* %16, i32 128)
%18 = load i8*, i8** %7
%19 = load i8**, i8*** %9
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @strncpy(i8* %18, i8* %21, i32 128)
store i32 1, i32* %5
br label %33
23: ; preds = %4
%24 = load i32, i32* @stderr
%25 = load i8**, i8*** %9
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = load i8**, i8*** %9
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 @usage(i8* %31)
store i32 0, i32* %5
br label %33
33: ; preds = %23, %12
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"ERROR: '%s' must have a string as argument.. Exiting\0A\00"
define i32 @parse_cli(i8* %0, i8* %1, i32 %2, i8** nocapture %3) {
%5 = icmp eq i32 %2, 3
br i1 %5, label %6, label %13
6: ; preds = %4
%7 = getelementptr inbounds i8*, i8** %3, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strncpy(i8* %0, i8* %8, i32 128)
%10 = getelementptr inbounds i8*, i8** %3, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @strncpy(i8* %1, i8* %11, i32 128)
br label %19
13: ; preds = %4
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %3
%16 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %3
%18 = tail call i32 @usage(i8* %17)
br label %19
19: ; preds = %13, %6
%20 = phi i32 [ 1, %6 ], [ 0, %13 ]
ret i32 %20
}