int of_getprop(int handle, const char *prop, void *buf, int buf_len) {
  struct {
    const char *name;
    int num_args;
    int num_returns;
    int handle;
    const char *prop;
    void *buf;
    int buf_len;
    int size;
  } args;
  args.name = "getprop";
  args.num_args = 4;
  args.num_returns = 1;
  args.handle = handle;
  args.prop = prop;
  args.buf = buf;
  args.buf_len = buf_len;
  of(&args);
  return args.size;
}


x86 assembly (clang, -O0):
<of_getprop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    0xed3(%rip),%rax
mov    %rax,-0x50(%rbp)
movl   $0x4,-0x48(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x0,%al
call   1030 <of@plt>
mov    -0x24(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<of_getprop>:
sub    $0x38,%rsp
lea    0xee5(%rip),%rax
mov    %rax,0x8(%rsp)
movabs $0x100000004,%rax
mov    %rax,0x10(%rsp)
mov    %edi,0x18(%rsp)
mov    %rsi,0x20(%rsp)
mov    %rdx,0x28(%rsp)
mov    %ecx,0x30(%rsp)
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1030 <of@plt>
mov    0x34(%rsp),%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
%struct.anon = type { i8*, i32, i32, i32, i8*, i8*, i32, i32 }
@.str = [8 x i8] c"getprop\00"
define i32 @of_getprop(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca %struct.anon
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 1
store i32 4, i32* %11
%12 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 2
store i32 1, i32* %12
%13 = load i32, i32* %5
%14 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 3
store i32 %13, i32* %14
%15 = load i8*, i8** %6
%16 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 4
store i8* %15, i8** %16
%17 = load i8*, i8** %7
%18 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 5
store i8* %17, i8** %18
%19 = load i32, i32* %8
%20 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 6
store i32 %19, i32* %20
%21 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @of to i32 (%struct.anon*, ...)*)(%struct.anon* %9)
%22 = getelementptr inbounds %struct.anon, %struct.anon* %9, i32 0, i32 7
%23 = load i32, i32* %22
ret i32 %23
}

LLVM IR (-O2):
%struct.anon = type { i8*, i32, i32, i32, i8*, i8*, i32, i32 }
@.str = [8 x i8] c"getprop\00"
define i32 @of_getprop(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca %struct.anon
%6 = bitcast %struct.anon* %5 to i8*
%7 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 1
store i32 4, i32* %8
%9 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 2
store i32 1, i32* %9
%10 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 3
store i32 %0, i32* %10
%11 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 4
store i8* %1, i8** %11
%12 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 5
store i8* %2, i8** %12
%13 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 6
store i32 %3, i32* %13
%14 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @of to i32 (%struct.anon*, ...)*)(%struct.anon* %5)
%15 = getelementptr inbounds %struct.anon, %struct.anon* %5, i64 0, i32 7
%16 = load i32, i32* %15
ret i32 %16
}