#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 */
struct cli {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, ...);
int /*<<< orphan*/ cli_send(struct cli *, char *, scalar_t__);
int /*<<< orphan*/ free(char *);
scalar_t__ strlen(char *);
int _set_string(struct cli *cli, int argc, char *argv[]) {
  if (argc <= 0) {
    {
      char *__tmp;
      asprintf(&__tmp, "> "
                       "argc <= 0 is invalid"
                       "\n\r");
      cli_send(cli, __tmp, strlen(__tmp) + 1);
      free(__tmp);
    };
    return (-1);
  }
  {
    char *__tmp;
    asprintf(&__tmp,
             "argc = %d, LALALA = %s, LULULU = %s"
             "\n\r",
             argc, argv[0], argv[1]);
    cli_send(cli, __tmp, strlen(__tmp) + 1);
    free(__tmp);
  };
  return (0);
}


x86 assembly (clang, -O0):
<_set_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     11b1 <_set_string+0x71>
lea    -0x28(%rbp),%rdi
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1050 <asprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1060 <cli_send@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1212 <_set_string+0xd2>
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%r8
lea    -0x30(%rbp),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1050 <asprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1060 <cli_send@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_string>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
test   %esi,%esi
jle    1197 <_set_string+0x57>
mov    %esi,%eax
mov    (%rdx),%rcx
mov    0x8(%rdx),%r8
lea    0xeba(%rip),%rsi
xor    %ebp,%ebp
lea    0x8(%rsp),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <asprintf@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <cli_send@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
jmp    11d5 <_set_string+0x95>
lea    0xe62(%rip),%rsi
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1050 <asprintf@plt>
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <cli_send@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.cli = type { i32 }
@.str = [25 x i8] c"> argc <= 0 is invalid\0A\0D\00"
@.str.1 = [38 x i8] c"argc = %d, LALALA = %s, LULULU = %s\0A\0D\00"
define i32 @_set_string(%struct.cli* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca %struct.cli*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i8*
store %struct.cli* %0, %struct.cli** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%10 = load i32, i32* %6
%11 = icmp sle i32 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %3
%13 = call i32 (i8**, i8*, ...) @asprintf(i8** %8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%14 = load %struct.cli*, %struct.cli** %5
%15 = load i8*, i8** %8
%16 = load i8*, i8** %8
%17 = call i64 @strlen(i8* %16)
%18 = add nsw i64 %17, 1
%19 = call i32 @cli_send(%struct.cli* %14, i8* %15, i64 %18)
%20 = load i8*, i8** %8
%21 = call i32 @free(i8* %20)
store i32 -1, i32* %4
br label %39
22: ; preds = %3
%23 = load i32, i32* %6
%24 = load i8**, i8*** %7
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %7
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 (i8**, i8*, ...) @asprintf(i8** %9, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %23, i8* %26, i8* %29)
%31 = load %struct.cli*, %struct.cli** %5
%32 = load i8*, i8** %9
%33 = load i8*, i8** %9
%34 = call i64 @strlen(i8* %33)
%35 = add nsw i64 %34, 1
%36 = call i32 @cli_send(%struct.cli* %31, i8* %32, i64 %35)
%37 = load i8*, i8** %9
%38 = call i32 @free(i8* %37)
store i32 0, i32* %4
br label %39
39: ; preds = %22, %12
%40 = load i32, i32* %4
ret i32 %40
}

LLVM IR (-O2):
%struct.cli = type { i32 }
@.str = [25 x i8] c"> argc <= 0 is invalid\0A\0D\00"
@.str.1 = [38 x i8] c"argc = %d, LALALA = %s, LULULU = %s\0A\0D\00"
define i32 @_set_string(%struct.cli* %0, i32 %1, i8** nocapture %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = icmp slt i32 %1, 1
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = bitcast i8** %4 to i8*
%9 = call i32 (i8**, i8*, ...) @asprintf(i8** %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %4
%11 = call i64 @strlen(i8* dereferenceable(1) %10)
%12 = add nsw i64 %11, 1
%13 = call i32 @cli_send(%struct.cli* %0, i8* %10, i64 %12)
%14 = load i8*, i8** %4
%15 = call i32 @free(i8* %14)
br label %28
16: ; preds = %3
%17 = bitcast i8** %5 to i8*
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8*, i8** %2, i64 1
%20 = load i8*, i8** %19
%21 = call i32 (i8**, i8*, ...) @asprintf(i8** %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %18, i8* %20)
%22 = load i8*, i8** %5
%23 = call i64 @strlen(i8* dereferenceable(1) %22)
%24 = add nsw i64 %23, 1
%25 = call i32 @cli_send(%struct.cli* %0, i8* %22, i64 %24)
%26 = load i8*, i8** %5
%27 = call i32 @free(i8* %26)
br label %28
28: ; preds = %16, %7
%29 = phi i32 [ -1, %7 ], [ 0, %16 ]
ret i32 %29
}