#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);
int atoi(char *);
int /*<<< orphan*/ cli_send(struct cli *, char *, scalar_t__);
int /*<<< orphan*/ free(char *);
scalar_t__ strlen(char *);
int _set_option(struct cli *cli, int argc, char *argv[]) {
  {
    char *__tmp;
    asprintf(&__tmp,
             "set option : argc = %d"
             "\n\r",
             argc);
    cli_send(cli, __tmp, strlen(__tmp) + 1);
    free(__tmp);
  };
  if (argc > 0) {
    int value = atoi(argv[0]);
    {
      char *__tmp;
      asprintf(&__tmp,
               "set option value = %d"
               "\n\r",
               value);
      cli_send(cli, __tmp, strlen(__tmp) + 1);
      free(__tmp);
    };
  }
  return (0);
}


x86 assembly (clang, -O0):
<_set_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%edx
lea    -0x20(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1050 <asprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1070 <cli_send@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0xc(%rbp)
jle    120e <_set_option+0xbe>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edx
lea    -0x30(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1050 <asprintf@plt>
mov    -0x8(%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   1070 <cli_send@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_option>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r15
lea    0xe9a(%rip),%rsi
mov    %rsp,%rdi
mov    %ebp,%edx
call   1050 <asprintf@plt>
mov    (%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <cli_send@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
test   %ebp,%ebp
jle    11d5 <_set_option+0x85>
mov    (%r14),%rdi
call   1060 <atoi@plt>
lea    0xe72(%rip),%rsi
mov    %rsp,%rdi
mov    %eax,%edx
call   1050 <asprintf@plt>
mov    (%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <cli_send@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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