#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 */
struct Context {
  int dummy;
};

/* Variables and functions */
long pop_to_long();
int /*<<< orphan*/ push_nil();
int /*<<< orphan*/ push_t();
void builtin_lt(struct Context *ctx, unsigned int stack_track) {
  if (stack_track < 2) {
    push_nil();
    return;
  }
  unsigned int result = 1;
  long previous = pop_to_long(), current;
  for (stack_track--; stack_track; stack_track--) {
    current = pop_to_long();
    if (previous >= current) {
      result--;
      break;
    }
    previous = current;
  }
  if (result)
    push_t();
  else
    push_nil();
}


x86 assembly (clang, -O0):
<builtin_lt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jae    1155 <builtin_lt+0x25>
mov    $0x0,%al
call   1050 <push_nil@plt>
jmp    11d4 <builtin_lt+0xa4>
movl   $0x1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <pop_to_long@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11b7 <builtin_lt+0x87>
mov    $0x0,%al
call   1030 <pop_to_long@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jl     11a1 <builtin_lt+0x71>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11b7 <builtin_lt+0x87>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1170 <builtin_lt+0x40>
cmpl   $0x0,-0x10(%rbp)
je     11cd <builtin_lt+0x9d>
mov    $0x0,%al
call   1040 <push_t@plt>
jmp    11d4 <builtin_lt+0xa4>
mov    $0x0,%al
call   1050 <push_nil@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<builtin_lt>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%esi
jbe    1164 <builtin_lt+0x34>
mov    %esi,%ebx
xor    %eax,%eax
call   1030 <pop_to_long@plt>
mov    %rax,%r14
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
add    $0xffffffff,%ebx
je     1172 <builtin_lt+0x42>
call   1030 <pop_to_long@plt>
cmp    %rax,%r14
mov    %rax,%r14
jl     1150 <builtin_lt+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <push_nil@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <push_t@plt>

LLVM IR (-O0):
%struct.Context = type { i32 }
define void @builtin_lt(%struct.Context* %0, i32 %1) {
%3 = alloca %struct.Context*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
store %struct.Context* %0, %struct.Context** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = icmp ult i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @push_nil()
br label %39
12: ; preds = %2
store i32 1, i32* %5
%13 = call i64 (...) @pop_to_long()
store i64 %13, i64* %6
%14 = load i32, i32* %4
%15 = add i32 %14, -1
store i32 %15, i32* %4
br label %16
16: ; preds = %29, %12
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %32
19: ; preds = %16
%20 = call i64 (...) @pop_to_long()
store i64 %20, i64* %7
%21 = load i64, i64* %6
%22 = load i64, i64* %7
%23 = icmp sge i64 %21, %22
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load i32, i32* %5
%26 = add i32 %25, -1
store i32 %26, i32* %5
br label %32
27: ; preds = %19
%28 = load i64, i64* %7
store i64 %28, i64* %6
br label %29
29: ; preds = %27
%30 = load i32, i32* %4
%31 = add i32 %30, -1
store i32 %31, i32* %4
br label %16
32: ; preds = %24, %16
%33 = load i32, i32* %5
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 (...) @push_t()
br label %39
37: ; preds = %32
%38 = call i32 (...) @push_nil()
br label %39
39: ; preds = %10, %37, %35
ret void
}

LLVM IR (-O2):
%struct.Context = type { i32 }
define void @builtin_lt(%struct.Context* nocapture readnone %0, i32 %1) {
%3 = icmp ult i32 %1, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @push_nil()
br label %20
6: ; preds = %2
%7 = tail call i64 (...) @pop_to_long()
br label %8
8: ; preds = %13, %6
%9 = phi i64 [ %7, %6 ], [ %14, %13 ]
%10 = phi i32 [ %1, %6 ], [ %11, %13 ]
%11 = add i32 %10, -1
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = tail call i64 (...) @pop_to_long()
%15 = icmp slt i64 %9, %14
br i1 %15, label %8, label %18
16: ; preds = %8
%17 = tail call i32 (...) @push_t()
br label %20
18: ; preds = %13
%19 = tail call i32 (...) @push_nil()
br label %20
20: ; preds = %16, %18, %4
ret void
}