#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 /*<<< orphan*/ assert(int);
void aiger_new_code(unsigned var, unsigned *new, unsigned *code) {
  unsigned lit = (((unsigned)(var)) << 1), res;
  assert(!code[lit]);
  res = *new;
  code[lit] = res;
  code[lit + 1] = res + 1;
  *new += 2;
}


x86 assembly (clang, -O0):
<aiger_new_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
cmpl   $0x0,(%rax,%rcx,4)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aiger_new_code>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%r15d
lea    (%r15,%r15,1),%r12d
xor    %edi,%edi
cmpl   $0x0,(%rdx,%r12,4)
sete   %dil
call   1030 <assert@plt>
mov    (%r14),%eax
mov    %eax,(%rbx,%r12,4)
add    $0x1,%eax
lea    (%r15,%r15,1),%ecx
add    $0x1,%ecx
mov    %eax,(%rbx,%rcx,4)
addl   $0x2,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @aiger_new_code(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32, i32* %4
%10 = shl i32 %9, 1
store i32 %10, i32* %7
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = load i32*, i32** %6
%24 = load i32, i32* %7
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
%27 = load i32, i32* %8
%28 = add i32 %27, 1
%29 = load i32*, i32** %6
%30 = load i32, i32* %7
%31 = add i32 %30, 1
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %29, i64 %32
store i32 %28, i32* %33
%34 = load i32*, i32** %5
%35 = load i32, i32* %34
%36 = add i32 %35, 2
store i32 %36, i32* %34
ret void
}

LLVM IR (-O2):
define void @aiger_new_code(i32 %0, i32* nocapture %1, i32* nocapture %2) {
%4 = shl i32 %0, 1
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %2, i64 %5
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = load i32, i32* %1
store i32 %11, i32* %6
%12 = add i32 %11, 1
%13 = or i32 %4, 1
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %2, i64 %14
store i32 %12, i32* %15
%16 = load i32, i32* %1
%17 = add i32 %16, 2
store i32 %17, i32* %1
ret void
}