#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 */

/* Variables and functions */
int getClientKeyringSize(int);
int /*<<< orphan*/ setClientKeyringSize(int, int);
int createClientKeyringEntry(int handle) {
  int retValue_acc;
  int size;
  int tmp;
  int __cil_tmp5;
  {
    {
      tmp = getClientKeyringSize(handle);
      size = tmp;
    }
    if (size < 2) {
      {
        __cil_tmp5 = size + 1;
        setClientKeyringSize(handle, __cil_tmp5);
        retValue_acc = size + 1;
      }
      return (retValue_acc);
    } else {
      retValue_acc = -1;
      return (retValue_acc);
    }
    return (retValue_acc);
  }
}


x86 assembly (clang, -O0):
<createClientKeyringEntry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <getClientKeyringSize@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
jge    116e <createClientKeyringEntry+0x4e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <setClientKeyringSize@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <createClientKeyringEntry+0x5b>
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createClientKeyringEntry>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1040 <getClientKeyringSize@plt>
mov    %eax,%ebp
mov    $0xffffffff,%eax
cmp    $0x1,%ebp
jg     1144 <createClientKeyringEntry+0x24>
add    $0x1,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <setClientKeyringSize@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @createClientKeyringEntry(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @getClientKeyringSize(i32 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %22
13: ; preds = %1
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %7
%16 = load i32, i32* %3
%17 = load i32, i32* %7
%18 = call i32 @setClientKeyringSize(i32 %16, i32 %17)
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
%21 = load i32, i32* %4
store i32 %21, i32* %2
br label %24
22: ; preds = %1
store i32 -1, i32* %4
%23 = load i32, i32* %4
store i32 %23, i32* %2
br label %24
24: ; preds = %22, %13
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @createClientKeyringEntry(i32 %0) {
%2 = tail call i32 @getClientKeyringSize(i32 %0)
%3 = icmp slt i32 %2, 2
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = add nsw i32 %2, 1
%6 = tail call i32 @setClientKeyringSize(i32 %0, i32 %5)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %5, %4 ], [ -1, %1 ]
ret i32 %8
}