#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 Tuple2_Int_Int {
  int dummy;
};

/* Variables and functions */
struct Tuple2_Int_Int *Tuple2_0(int, int);
int distant2_0(struct Tuple2_Int_Int *, struct Tuple2_Int_Int *);
int node_point(int inX, int inY, struct Tuple2_Int_Int *point_at_last,
               struct Tuple2_Int_Int **output) {
  int _tmp001;
  struct Tuple2_Int_Int *_tmp000;
  _tmp001 = distant2_0(Tuple2_0(0, 0), point_at_last);
  if (1) {
    int _tmp003;
    int pvar0_d1 = _tmp001;
    struct Tuple2_Int_Int *_tmp002;
    _tmp003 = distant2_0(Tuple2_0(0, 0), Tuple2_0(inX, inY));
    if (1) {
      int _tmp005;
      int pvar1_d2 = _tmp003;
      struct Tuple2_Int_Int *_tmp004;
      _tmp005 = (pvar0_d1 < pvar1_d2);
      if (_tmp005 == 1) {
        _tmp004 = Tuple2_0(inX, inY);
      } else if (_tmp005 == 0) {
        _tmp004 = point_at_last;
      }
      _tmp002 = _tmp004;
    }
    _tmp000 = _tmp002;
  }
  *output = _tmp000;
  return 1;
}


x86 assembly (clang, -O0):
<node_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1030 <Tuple2_0@plt>
mov    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <distant2_0@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1030 <Tuple2_0@plt>
mov    %rax,-0x50(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <Tuple2_0@plt>
mov    -0x50(%rbp),%rdi
mov    %rax,%rsi
call   1040 <distant2_0@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x40(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x1,-0x3c(%rbp)
jne    11b0 <node_point+0x90>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <Tuple2_0@plt>
mov    %rax,-0x48(%rbp)
jmp    11c7 <node_point+0xa7>
cmpl   $0x0,-0x3c(%rbp)
jne    11c2 <node_point+0xa2>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    11c7 <node_point+0xa7>
mov    -0x48(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<node_point>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %edi,%r12d
xor    %edi,%edi
xor    %esi,%esi
call   1030 <Tuple2_0@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <distant2_0@plt>
mov    %eax,%r13d
xor    %edi,%edi
xor    %esi,%esi
call   1030 <Tuple2_0@plt>
mov    %rax,%rbp
mov    %r12d,%edi
mov    %r15d,%esi
call   1030 <Tuple2_0@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
call   1040 <distant2_0@plt>
cmp    %eax,%r13d
jge    1183 <node_point+0x63>
mov    %r12d,%edi
mov    %r15d,%esi
call   1030 <Tuple2_0@plt>
mov    %rax,%rbx
mov    %rbx,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.Tuple2_Int_Int = type { i32 }
define i32 @node_point(i32 %0, i32 %1, %struct.Tuple2_Int_Int* %2, %struct.Tuple2_Int_Int** nocapture writeonly %3) {
%5 = tail call %struct.Tuple2_Int_Int* @Tuple2_0(i32 0, i32 0)
%6 = tail call i32 @distant2_0(%struct.Tuple2_Int_Int* %5, %struct.Tuple2_Int_Int* %2)
%7 = tail call %struct.Tuple2_Int_Int* @Tuple2_0(i32 0, i32 0)
%8 = tail call %struct.Tuple2_Int_Int* @Tuple2_0(i32 %0, i32 %1)
%9 = tail call i32 @distant2_0(%struct.Tuple2_Int_Int* %7, %struct.Tuple2_Int_Int* %8)
%10 = icmp slt i32 %6, %9
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = tail call %struct.Tuple2_Int_Int* @Tuple2_0(i32 %0, i32 %1)
br label %13
13: ; preds = %4, %11
%14 = phi %struct.Tuple2_Int_Int* [ %12, %11 ], [ %2, %4 ]
store %struct.Tuple2_Int_Int* %14, %struct.Tuple2_Int_Int** %3
ret i32 1
}