#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 Kit_TruthWordNum(int);
int Kit_TruthIsEqualWithPhase(unsigned *pIn0, unsigned *pIn1, int nVars) {
  int w;
  if ((pIn0[0] & 1) == (pIn1[0] & 1)) {
    for (w = Kit_TruthWordNum(nVars) - 1; w >= 0; w--)
      if (pIn0[w] != pIn1[w])
        return 0;
  } else {
    for (w = Kit_TruthWordNum(nVars) - 1; w >= 0; w--)
      if (pIn0[w] != ~pIn1[w])
        return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<Kit_TruthIsEqualWithPhase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x1,%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
and    $0x1,%ecx
cmp    %ecx,%eax
jne    1195 <Kit_TruthIsEqualWithPhase+0x85>
mov    -0x1c(%rbp),%edi
call   1030 <Kit_TruthWordNum@plt>
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     1190 <Kit_TruthIsEqualWithPhase+0x80>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     117d <Kit_TruthIsEqualWithPhase+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    11f9 <Kit_TruthIsEqualWithPhase+0xe9>
jmp    1182 <Kit_TruthIsEqualWithPhase+0x72>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    114b <Kit_TruthIsEqualWithPhase+0x3b>
jmp    11f2 <Kit_TruthIsEqualWithPhase+0xe2>
mov    -0x1c(%rbp),%edi
call   1030 <Kit_TruthWordNum@plt>
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     11ed <Kit_TruthIsEqualWithPhase+0xdd>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
xor    $0xffffffff,%ecx
cmp    %ecx,%eax
je     11da <Kit_TruthIsEqualWithPhase+0xca>
movl   $0x0,-0x4(%rbp)
jmp    11f9 <Kit_TruthIsEqualWithPhase+0xe9>
jmp    11df <Kit_TruthIsEqualWithPhase+0xcf>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    11a3 <Kit_TruthIsEqualWithPhase+0x93>
jmp    11f2 <Kit_TruthIsEqualWithPhase+0xe2>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Kit_TruthIsEqualWithPhase>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rsi),%ebp
xor    (%rdi),%ebp
mov    %edx,%edi
call   1030 <Kit_TruthWordNum@plt>
mov    %eax,%eax
test   $0x1,%bpl
jne    1150 <Kit_TruthIsEqualWithPhase+0x40>
nopl   (%rax)
test   %eax,%eax
jle    116c <Kit_TruthIsEqualWithPhase+0x5c>
mov    -0x4(%rbx,%rax,4),%ecx
lea    -0x1(%rax),%rdx
cmp    -0x4(%r14,%rax,4),%ecx
mov    %rdx,%rax
je     1130 <Kit_TruthIsEqualWithPhase+0x20>
jmp    1168 <Kit_TruthIsEqualWithPhase+0x58>
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
jle    116c <Kit_TruthIsEqualWithPhase+0x5c>
mov    -0x4(%r14,%rax,4),%ecx
not    %ecx
lea    -0x1(%rax),%rdx
cmp    %ecx,-0x4(%rbx,%rax,4)
mov    %rdx,%rax
je     1150 <Kit_TruthIsEqualWithPhase+0x40>
xor    %eax,%eax
jmp    1171 <Kit_TruthIsEqualWithPhase+0x61>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Kit_TruthIsEqualWithPhase(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** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%9 = load i32*, i32** %5
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = and i32 %11, 1
%13 = load i32*, i32** %6
%14 = getelementptr inbounds i32, i32* %13, i64 0
%15 = load i32, i32* %14
%16 = and i32 %15, 1
%17 = icmp eq i32 %12, %16
br i1 %17, label %18, label %43
18: ; preds = %3
%19 = load i32, i32* %7
%20 = call i32 @Kit_TruthWordNum(i32 %19)
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %8
br label %22
22: ; preds = %39, %18
%23 = load i32, i32* %8
%24 = icmp sge i32 %23, 0
br i1 %24, label %25, label %42
25: ; preds = %22
%26 = load i32*, i32** %5
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = load i32*, i32** %6
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = icmp ne i32 %30, %35
br i1 %36, label %37, label %38
37: ; preds = %25
store i32 0, i32* %4
br label %70
38: ; preds = %25
br label %39
39: ; preds = %38
%40 = load i32, i32* %8
%41 = add nsw i32 %40, -1
store i32 %41, i32* %8
br label %22
42: ; preds = %22
br label %69
43: ; preds = %3
%44 = load i32, i32* %7
%45 = call i32 @Kit_TruthWordNum(i32 %44)
%46 = sub nsw i32 %45, 1
store i32 %46, i32* %8
br label %47
47: ; preds = %65, %43
%48 = load i32, i32* %8
%49 = icmp sge i32 %48, 0
br i1 %49, label %50, label %68
50: ; preds = %47
%51 = load i32*, i32** %5
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %51, i64 %53
%55 = load i32, i32* %54
%56 = load i32*, i32** %6
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %56, i64 %58
%60 = load i32, i32* %59
%61 = xor i32 %60, -1
%62 = icmp ne i32 %55, %61
br i1 %62, label %63, label %64
63: ; preds = %50
store i32 0, i32* %4
br label %70
64: ; preds = %50
br label %65
65: ; preds = %64
%66 = load i32, i32* %8
%67 = add nsw i32 %66, -1
store i32 %67, i32* %8
br label %47
68: ; preds = %47
br label %69
69: ; preds = %68, %42
store i32 1, i32* %4
br label %70
70: ; preds = %69, %63, %37
%71 = load i32, i32* %4
ret i32 %71
}

LLVM IR (-O2):
define i32 @Kit_TruthIsEqualWithPhase(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %1
%6 = xor i32 %5, %4
%7 = and i32 %6, 1
%8 = icmp eq i32 %7, 0
%9 = tail call i32 @Kit_TruthWordNum(i32 %2)
%10 = zext i32 %9 to i64
br i1 %8, label %11, label %22
11: ; preds = %3, %16
%12 = phi i64 [ %13, %16 ], [ %10, %3 ]
%13 = add nsw i64 %12, -1
%14 = trunc i64 %12 to i32
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %34
16: ; preds = %11
%17 = getelementptr inbounds i32, i32* %0, i64 %13
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %1, i64 %13
%20 = load i32, i32* %19
%21 = icmp eq i32 %18, %20
br i1 %21, label %11, label %34
22: ; preds = %3, %27
%23 = phi i64 [ %24, %27 ], [ %10, %3 ]
%24 = add nsw i64 %23, -1
%25 = trunc i64 %23 to i32
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %22
%28 = getelementptr inbounds i32, i32* %0, i64 %24
%29 = load i32, i32* %28
%30 = getelementptr inbounds i32, i32* %1, i64 %24
%31 = load i32, i32* %30
%32 = xor i32 %31, -1
%33 = icmp eq i32 %29, %32
br i1 %33, label %22, label %34
34: ; preds = %22, %27, %11, %16
%35 = phi i32 [ 1, %11 ], [ 0, %16 ], [ 1, %22 ], [ 0, %27 ]
ret i32 %35
}