int cli_get_value(Name, Buffer, Size)
char *Name;
char *Buffer;
{
  struct {
    int Size;
    char *Ptr;
  } Descr1, Descr2;
  Descr1.Ptr = Name;
  Descr1.Size = strlen(Name);
  Descr2.Ptr = Buffer;
  Descr2.Size = Size - 1;
  if (cli$get_value(&Descr1, &Descr2, &Descr2.Size) & 1) {
    Buffer[Descr2.Size] = 0;
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<cli_get_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x40(%rbp)
lea    -0x40(%rbp),%rdx
lea    -0x30(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1030 <cli$get_value@plt>
and    $0x1,%eax
cmp    $0x0,%eax
je     118f <cli_get_value+0x6f>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x4(%rbp)
jmp    1196 <cli_get_value+0x76>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_get_value>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,0x20(%rsp)
call   1040 <strlen@plt>
mov    %eax,0x18(%rsp)
mov    %rbx,0x10(%rsp)
add    $0xffffffff,%ebp
mov    %ebp,0x8(%rsp)
xor    %ebp,%ebp
lea    0x18(%rsp),%rdi
lea    0x8(%rsp),%rdx
mov    %rdx,%rsi
xor    %eax,%eax
call   1030 <cli$get_value@plt>
test   $0x1,%al
je     116d <cli_get_value+0x4d>
movslq 0x8(%rsp),%rax
movb   $0x0,(%rbx,%rax,1)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.anon = type { i32, i8* }
define i32 @cli_get_value(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.anon
%9 = alloca %struct.anon
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%10 = load i8*, i8** %5
%11 = getelementptr inbounds %struct.anon, %struct.anon* %8, i32 0, i32 1
store i8* %10, i8** %11
%12 = load i8*, i8** %5
%13 = call i64 @strlen(i8* %12)
%14 = trunc i64 %13 to i32
%15 = getelementptr inbounds %struct.anon, %struct.anon* %8, i32 0, i32 0
store i32 %14, i32* %15
%16 = load i8*, i8** %6
%17 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 1
store i8* %16, i8** %17
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1
%20 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 0
store i32 %19, i32* %20
%21 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 0
%22 = call i32 (%struct.anon*, %struct.anon*, i32*, ...) bitcast (i32 (...)* @"cli$get_value" to i32 (%struct.anon*, %struct.anon*, i32*, ...)*)(%struct.anon* %8, %struct.anon* %9, i32* %21)
%23 = and i32 %22, 1
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %3
%26 = load i8*, i8** %6
%27 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 0
%28 = load i32, i32* %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
store i8 0, i8* %30
store i32 1, i32* %4
br label %32
31: ; preds = %3
store i32 0, i32* %4
br label %32
32: ; preds = %31, %25
%33 = load i32, i32* %4
ret i32 %33
}

LLVM IR (-O2):
%struct.anon = type { i32, i8* }
define i32 @cli_get_value(i8* %0, i8* %1, i32 %2) {
%4 = alloca %struct.anon
%5 = alloca %struct.anon
%6 = bitcast %struct.anon* %4 to i8*
%7 = bitcast %struct.anon* %5 to i8*
%8 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 1
store i8* %0, i8** %8
%9 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%10 = trunc i64 %9 to i32
%11 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 0
store i32 %10, i32* %11
%12 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 1
store i8* %1, i8** %12
%13 = add nsw i32 %2, -1
%14 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 0
store i32 %13, i32* %14
%15 = call i32 (%struct.anon*, %struct.anon*, i32*, ...) bitcast (i32 (...)* @"cli$get_value" to i32 (%struct.anon*, %struct.anon*, i32*, ...)*)(%struct.anon* %4, %struct.anon* %5, i32* %14)
%16 = and i32 %15, 1
%17 = icmp eq i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %3
%19 = load i32, i32* %14
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %1, i64 %20
store i8 0, i8* %21
br label %22
22: ; preds = %3, %18
%23 = phi i32 [ 1, %18 ], [ 0, %3 ]
ret i32 %23
}