#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 iam_leaf {
  int dummy;
};
struct iam_key {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __lvar_key_set(struct iam_leaf *, struct iam_key const *);
int /*<<< orphan*/ assert_corr(int);
int /*<<< orphan*/ assert_inv(int /*<<< orphan*/);
scalar_t__ e_keysize(int /*<<< orphan*/);
int iam_leaf_is_locked(struct iam_leaf *);
int /*<<< orphan*/ kchar(struct iam_key const *);
int n_at_rec(struct iam_leaf *);
int /*<<< orphan*/ n_cur(struct iam_leaf *);
int /*<<< orphan*/ n_invariant(struct iam_leaf *);
scalar_t__ strlen(int /*<<< orphan*/);
void lvar_key_set(struct iam_leaf *l, const struct iam_key *k) {
  assert_corr(n_at_rec(l));
  assert_corr(strlen(kchar(k)) == e_keysize(n_cur(l)));
  assert_corr(iam_leaf_is_locked(l));
  __lvar_key_set(l, k);
  assert_inv(n_invariant(l));
}


x86 assembly (clang, -O0):
<lvar_key_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <n_at_rec@plt>
mov    %eax,%edi
call   10b0 <assert_corr@plt>
mov    -0x10(%rbp),%rdi
call   1050 <kchar@plt>
mov    %eax,%edi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <n_cur@plt>
mov    %eax,%edi
call   1060 <e_keysize@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert_corr@plt>
mov    -0x8(%rbp),%rdi
call   1090 <iam_leaf_is_locked@plt>
mov    %eax,%edi
call   10b0 <assert_corr@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <__lvar_key_set@plt>
mov    -0x8(%rbp),%rdi
call   10c0 <n_invariant@plt>
mov    %eax,%edi
call   10a0 <assert_inv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lvar_key_set>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1070 <n_at_rec@plt>
mov    %eax,%edi
call   10b0 <assert_corr@plt>
mov    %r14,%rdi
call   1050 <kchar@plt>
mov    %eax,%edi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <n_cur@plt>
mov    %eax,%edi
call   1060 <e_keysize@plt>
xor    %edi,%edi
cmp    %rax,%r15
sete   %dil
call   10b0 <assert_corr@plt>
mov    %rbx,%rdi
call   1090 <iam_leaf_is_locked@plt>
mov    %eax,%edi
call   10b0 <assert_corr@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <__lvar_key_set@plt>
mov    %rbx,%rdi
call   10c0 <n_invariant@plt>
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    10a0 <assert_inv@plt>

LLVM IR (-O0):
%struct.iam_leaf = type { i32 }
%struct.iam_key = type { i32 }
define void @lvar_key_set(%struct.iam_leaf* %0, %struct.iam_key* %1) {
%3 = alloca %struct.iam_leaf*
%4 = alloca %struct.iam_key*
store %struct.iam_leaf* %0, %struct.iam_leaf** %3
store %struct.iam_key* %1, %struct.iam_key** %4
%5 = load %struct.iam_leaf*, %struct.iam_leaf** %3
%6 = call i32 @n_at_rec(%struct.iam_leaf* %5)
%7 = call i32 @assert_corr(i32 %6)
%8 = load %struct.iam_key*, %struct.iam_key** %4
%9 = call i32 @kchar(%struct.iam_key* %8)
%10 = call i64 @strlen(i32 %9)
%11 = load %struct.iam_leaf*, %struct.iam_leaf** %3
%12 = call i32 @n_cur(%struct.iam_leaf* %11)
%13 = call i64 @e_keysize(i32 %12)
%14 = icmp eq i64 %10, %13
%15 = zext i1 %14 to i32
%16 = call i32 @assert_corr(i32 %15)
%17 = load %struct.iam_leaf*, %struct.iam_leaf** %3
%18 = call i32 @iam_leaf_is_locked(%struct.iam_leaf* %17)
%19 = call i32 @assert_corr(i32 %18)
%20 = load %struct.iam_leaf*, %struct.iam_leaf** %3
%21 = load %struct.iam_key*, %struct.iam_key** %4
%22 = call i32 @__lvar_key_set(%struct.iam_leaf* %20, %struct.iam_key* %21)
%23 = load %struct.iam_leaf*, %struct.iam_leaf** %3
%24 = call i32 @n_invariant(%struct.iam_leaf* %23)
%25 = call i32 @assert_inv(i32 %24)
ret void
}

LLVM IR (-O2):
%struct.iam_leaf = type { i32 }
%struct.iam_key = type { i32 }
define void @lvar_key_set(%struct.iam_leaf* %0, %struct.iam_key* %1) {
%3 = tail call i32 @n_at_rec(%struct.iam_leaf* %0)
%4 = tail call i32 @assert_corr(i32 %3)
%5 = tail call i32 @kchar(%struct.iam_key* %1)
%6 = tail call i64 @strlen(i32 %5)
%7 = tail call i32 @n_cur(%struct.iam_leaf* %0)
%8 = tail call i64 @e_keysize(i32 %7)
%9 = icmp eq i64 %6, %8
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert_corr(i32 %10)
%12 = tail call i32 @iam_leaf_is_locked(%struct.iam_leaf* %0)
%13 = tail call i32 @assert_corr(i32 %12)
%14 = tail call i32 @__lvar_key_set(%struct.iam_leaf* %0, %struct.iam_key* %1)
%15 = tail call i32 @n_invariant(%struct.iam_leaf* %0)
%16 = tail call i32 @assert_inv(i32 %15)
ret void
}