#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 */
typedef int uint64_t;

/* Variables and functions */
int ct_lt_u64(int, int);
int ct_mask_u64(int /*<<< orphan*/);
int /*<<< orphan*/ ct_ne_u64(int, int);
int cmplt_ct(uint64_t *a, uint64_t *b) {
  uint64_t r = 0;
  uint64_t m = 0;
  int i;
  for (i = 0; i < 3; ++i) {
    r |= ct_lt_u64(a[i], b[i]) & ~m;
    m |= ct_mask_u64(ct_ne_u64(a[i], b[i]));
  }
  return r & 1;
}


x86 assembly (clang, -O0):
<cmplt_ct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11be <cmplt_ct+0x8e>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1050 <ct_lt_u64@plt>
mov    -0x18(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <ct_ne_u64@plt>
mov    %eax,%edi
call   1040 <ct_mask_u64@plt>
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1155 <cmplt_ct+0x25>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmplt_ct>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r13
mov    (%rdi),%edi
mov    (%rsi),%esi
call   1050 <ct_lt_u64@plt>
mov    %eax,%ebx
mov    0x0(%r13),%edi
mov    (%r14),%esi
call   1030 <ct_ne_u64@plt>
mov    %eax,%edi
call   1040 <ct_mask_u64@plt>
mov    %eax,%r12d
mov    0x4(%r13),%edi
mov    0x4(%r14),%esi
call   1050 <ct_lt_u64@plt>
mov    %eax,%r15d
mov    %r12d,%eax
not    %eax
and    %eax,%r15d
or     %ebx,%r15d
mov    0x4(%r13),%edi
mov    0x4(%r14),%esi
call   1030 <ct_ne_u64@plt>
mov    %eax,%edi
call   1040 <ct_mask_u64@plt>
mov    %eax,%ebx
or     %r12d,%ebx
mov    0x8(%r13),%edi
mov    0x8(%r14),%esi
call   1050 <ct_lt_u64@plt>
mov    %eax,%ebp
not    %ebx
and    %ebx,%ebp
or     %r15d,%ebp
mov    0x8(%r13),%edi
mov    0x8(%r14),%esi
call   1030 <ct_ne_u64@plt>
mov    %eax,%edi
call   1040 <ct_mask_u64@plt>
and    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cmplt_ct(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %42, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %45
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = load i32*, i32** %4
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = call i32 @ct_lt_u64(i32 %16, i32 %21)
%23 = load i32, i32* %6
%24 = xor i32 %23, -1
%25 = and i32 %22, %24
%26 = load i32, i32* %5
%27 = or i32 %26, %25
store i32 %27, i32* %5
%28 = load i32*, i32** %3
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = load i32*, i32** %4
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
%37 = load i32, i32* %36
%38 = call i32 @ct_ne_u64(i32 %32, i32 %37)
%39 = call i32 @ct_mask_u64(i32 %38)
%40 = load i32, i32* %6
%41 = or i32 %40, %39
store i32 %41, i32* %6
br label %42
42: ; preds = %11
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %8
45: ; preds = %8
%46 = load i32, i32* %5
%47 = and i32 %46, 1
ret i32 %47
}

LLVM IR (-O2):
define i32 @cmplt_ct(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = tail call i32 @ct_lt_u64(i32 %3, i32 %4)
%6 = load i32, i32* %0
%7 = load i32, i32* %1
%8 = tail call i32 @ct_ne_u64(i32 %6, i32 %7)
%9 = tail call i32 @ct_mask_u64(i32 %8)
%10 = getelementptr inbounds i32, i32* %0, i64 1
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %1, i64 1
%13 = load i32, i32* %12
%14 = tail call i32 @ct_lt_u64(i32 %11, i32 %13)
%15 = xor i32 %9, -1
%16 = and i32 %14, %15
%17 = or i32 %16, %5
%18 = load i32, i32* %10
%19 = load i32, i32* %12
%20 = tail call i32 @ct_ne_u64(i32 %18, i32 %19)
%21 = tail call i32 @ct_mask_u64(i32 %20)
%22 = or i32 %21, %9
%23 = getelementptr inbounds i32, i32* %0, i64 2
%24 = load i32, i32* %23
%25 = getelementptr inbounds i32, i32* %1, i64 2
%26 = load i32, i32* %25
%27 = tail call i32 @ct_lt_u64(i32 %24, i32 %26)
%28 = xor i32 %22, -1
%29 = and i32 %27, %28
%30 = or i32 %29, %17
%31 = load i32, i32* %23
%32 = load i32, i32* %25
%33 = tail call i32 @ct_ne_u64(i32 %31, i32 %32)
%34 = tail call i32 @ct_mask_u64(i32 %33)
%35 = and i32 %30, 1
ret i32 %35
}