#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 node_pos(int pulse40ms, int x_at_last, int dx, int y_at_last, int dy,
             struct Tuple2_Int_Int *pos_at_last,
             struct Tuple2_Int_Int **output) {
  struct Tuple2_Int_Int *_tmp008;
  if (pulse40ms == 1) {
    _tmp008 = Tuple2_0((x_at_last + dx), (y_at_last + dy));
  } else if (pulse40ms == 0) {
    _tmp008 = pos_at_last;
  }
  *output = _tmp008;
  return 1;
}


x86 assembly (clang, -O0):
<node_pos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9,-0x20(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1154 <node_pos+0x44>
mov    -0x8(%rbp),%edi
add    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
add    -0x14(%rbp),%esi
call   1030 <Tuple2_0@plt>
mov    %rax,-0x28(%rbp)
jmp    116b <node_pos+0x5b>
cmpl   $0x0,-0x4(%rbp)
jne    1166 <node_pos+0x56>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    116b <node_pos+0x5b>
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<node_pos>:
push   %rbx
mov    0x10(%rsp),%rbx
cmp    $0x1,%edi
jne    112d <node_pos+0x1d>
add    %esi,%edx
add    %ecx,%r8d
mov    %edx,%edi
mov    %r8d,%esi
call   1030 <Tuple2_0@plt>
mov    %rax,%r9
mov    %r9,(%rbx)
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.Tuple2_Int_Int = type { i32 }
define i32 @node_pos(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, %struct.Tuple2_Int_Int* %5, %struct.Tuple2_Int_Int** %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.Tuple2_Int_Int*
%14 = alloca %struct.Tuple2_Int_Int**
%15 = alloca %struct.Tuple2_Int_Int*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store %struct.Tuple2_Int_Int* %5, %struct.Tuple2_Int_Int** %13
store %struct.Tuple2_Int_Int** %6, %struct.Tuple2_Int_Int*** %14
%16 = load i32, i32* %8
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %26
18: ; preds = %7
%19 = load i32, i32* %9
%20 = load i32, i32* %10
%21 = add nsw i32 %19, %20
%22 = load i32, i32* %11
%23 = load i32, i32* %12
%24 = add nsw i32 %22, %23
%25 = call %struct.Tuple2_Int_Int* @Tuple2_0(i32 %21, i32 %24)
store %struct.Tuple2_Int_Int* %25, %struct.Tuple2_Int_Int** %15
br label %32
26: ; preds = %7
%27 = load i32, i32* %8
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = load %struct.Tuple2_Int_Int*, %struct.Tuple2_Int_Int** %13
store %struct.Tuple2_Int_Int* %30, %struct.Tuple2_Int_Int** %15
br label %31
31: ; preds = %29, %26
br label %32
32: ; preds = %31, %18
%33 = load %struct.Tuple2_Int_Int*, %struct.Tuple2_Int_Int** %15
%34 = load %struct.Tuple2_Int_Int**, %struct.Tuple2_Int_Int*** %14
store %struct.Tuple2_Int_Int* %33, %struct.Tuple2_Int_Int** %34
ret i32 1
}

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