#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 sock_fprog {
  int dummy;
};
struct kafel_ctxt {
  int dummy;
};
struct codegen_ctxt {
  int dummy;
};

/* Variables and functions */
int compile_policy_impl(struct codegen_ctxt *, struct kafel_ctxt *,
                        struct sock_fprog *);
struct codegen_ctxt *context_create();
int /*<<< orphan*/ context_destroy(struct codegen_ctxt **);
int compile_policy(struct kafel_ctxt *kafel_ctxt, struct sock_fprog *prog) {
  struct codegen_ctxt *ctxt = context_create();
  int rv = compile_policy_impl(ctxt, kafel_ctxt, prog);
  context_destroy(&ctxt);
  return rv;
}


x86 assembly (clang, -O0):
<compile_policy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <context_create@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <compile_policy_impl@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <context_destroy@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compile_policy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <context_create@plt>
mov    %rax,(%rsp)
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <compile_policy_impl@plt>
mov    %eax,%ebx
mov    %rsp,%rdi
call   1030 <context_destroy@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.kafel_ctxt = type { i32 }
%struct.sock_fprog = type { i32 }
%struct.codegen_ctxt = type { i32 }
define i32 @compile_policy(%struct.kafel_ctxt* %0, %struct.sock_fprog* %1) {
%3 = alloca %struct.kafel_ctxt*
%4 = alloca %struct.sock_fprog*
%5 = alloca %struct.codegen_ctxt*
%6 = alloca i32
store %struct.kafel_ctxt* %0, %struct.kafel_ctxt** %3
store %struct.sock_fprog* %1, %struct.sock_fprog** %4
%7 = call %struct.codegen_ctxt* (...) @context_create()
store %struct.codegen_ctxt* %7, %struct.codegen_ctxt** %5
%8 = load %struct.codegen_ctxt*, %struct.codegen_ctxt** %5
%9 = load %struct.kafel_ctxt*, %struct.kafel_ctxt** %3
%10 = load %struct.sock_fprog*, %struct.sock_fprog** %4
%11 = call i32 @compile_policy_impl(%struct.codegen_ctxt* %8, %struct.kafel_ctxt* %9, %struct.sock_fprog* %10)
store i32 %11, i32* %6
%12 = call i32 @context_destroy(%struct.codegen_ctxt** %5)
%13 = load i32, i32* %6
ret i32 %13
}

LLVM IR (-O2):
%struct.kafel_ctxt = type { i32 }
%struct.sock_fprog = type { i32 }
%struct.codegen_ctxt = type { i32 }
define i32 @compile_policy(%struct.kafel_ctxt* %0, %struct.sock_fprog* %1) {
%3 = alloca %struct.codegen_ctxt*
%4 = bitcast %struct.codegen_ctxt** %3 to i8*
%5 = tail call %struct.codegen_ctxt* (...) @context_create()
store %struct.codegen_ctxt* %5, %struct.codegen_ctxt** %3
%6 = tail call i32 @compile_policy_impl(%struct.codegen_ctxt* %5, %struct.kafel_ctxt* %0, %struct.sock_fprog* %1)
%7 = call i32 @context_destroy(%struct.codegen_ctxt** %3)
ret i32 %6
}