#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*/ put_AC(int, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ put_bits(int, int, int);
void put_ACfirst(int run, int val, int id) {
  {
    if (run == 0) {
      if (val == 1) {
        put_bits(2 | (val < 0), 2, id);
      } else if (val == -1) {
        put_bits(2 | (val < 0), 2, id);
      } else {
        put_AC(run, val, 0, id);
      }
    } else {
      put_AC(run, val, 0, id);
    }
    return;
  }
}


x86 assembly (clang, -O0):
<put_ACfirst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11ab <put_ACfirst+0x8b>
cmpl   $0x1,-0x8(%rbp)
jne    1166 <put_ACfirst+0x46>
cmpl   $0x0,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
or     $0x2,%edi
mov    -0xc(%rbp),%edx
mov    $0x2,%esi
call   1030 <put_bits@plt>
jmp    11a6 <put_ACfirst+0x86>
cmpl   $0xffffffff,-0x8(%rbp)
jne    1191 <put_ACfirst+0x71>
cmpl   $0x0,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
or     $0x2,%edi
mov    -0xc(%rbp),%edx
mov    $0x2,%esi
call   1030 <put_bits@plt>
jmp    11a1 <put_ACfirst+0x81>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%ecx
xor    %edx,%edx
call   1040 <put_AC@plt>
jmp    11a6 <put_ACfirst+0x86>
jmp    11bb <put_ACfirst+0x9b>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%ecx
xor    %edx,%edx
call   1040 <put_AC@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_ACfirst>:
mov    %edx,%ecx
test   %edi,%edi
je     112d <put_ACfirst+0xd>
xor    %edx,%edx
jmp    1040 <put_AC@plt>
cmp    $0xffffffff,%esi
je     113e <put_ACfirst+0x1e>
cmp    $0x1,%esi
jne    114f <put_ACfirst+0x2f>
mov    $0x2,%edi
jmp    1143 <put_ACfirst+0x23>
mov    $0x3,%edi
mov    $0x2,%esi
mov    %ecx,%edx
jmp    1030 <put_bits@plt>
xor    %edi,%edi
xor    %edx,%edx
jmp    1040 <put_AC@plt>

LLVM IR (-O0):
define void @put_ACfirst(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %36
9: ; preds = %3
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 0
%15 = zext i1 %14 to i32
%16 = or i32 2, %15
%17 = load i32, i32* %6
%18 = call i32 @put_bits(i32 %16, i32 2, i32 %17)
br label %35
19: ; preds = %9
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 0
%25 = zext i1 %24 to i32
%26 = or i32 2, %25
%27 = load i32, i32* %6
%28 = call i32 @put_bits(i32 %26, i32 2, i32 %27)
br label %34
29: ; preds = %19
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = call i32 @put_AC(i32 %30, i32 %31, i32 0, i32 %32)
br label %34
34: ; preds = %29, %22
br label %35
35: ; preds = %34, %12
br label %41
36: ; preds = %3
%37 = load i32, i32* %4
%38 = load i32, i32* %5
%39 = load i32, i32* %6
%40 = call i32 @put_AC(i32 %37, i32 %38, i32 0, i32 %39)
br label %41
41: ; preds = %36, %35
ret void
}

LLVM IR (-O2):
define void @put_ACfirst(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %12
5: ; preds = %3
switch i32 %1, label %10 [
i32 1, label %6
i32 -1, label %8
]
6: ; preds = %5
%7 = tail call i32 @put_bits(i32 2, i32 2, i32 %2)
br label %14
8: ; preds = %5
%9 = tail call i32 @put_bits(i32 3, i32 2, i32 %2)
br label %14
10: ; preds = %5
%11 = tail call i32 @put_AC(i32 0, i32 %1, i32 0, i32 %2)
br label %14
12: ; preds = %3
%13 = tail call i32 @put_AC(i32 %0, i32 %1, i32 0, i32 %2)
br label %14
14: ; preds = %6, %10, %8, %12
ret void
}