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

/* Variables and functions */
struct Tuple2_Bool_Int *Tuple2_1(int, int);
int node_k(int pulse10ms, int pulse40msCount_at_last,
           struct Tuple2_Bool_Int **output) {
  int _tmp001;
  struct Tuple2_Bool_Int *_tmp000;
  _tmp001 = ((pulse40msCount_at_last + (pulse10ms)) % 4);
  if (1) {
    int pvar0_c = _tmp001;
    _tmp000 = Tuple2_1(((pvar0_c == 0) && pulse10ms), pvar0_c);
  }
  *output = _tmp000;
  return 1;
}


x86 assembly (clang, -O0):
<node_k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x25(%rbp)
jne    1152 <node_k+0x42>
cmpl   $0x0,-0x4(%rbp)
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    -0x24(%rbp),%esi
call   1030 <Tuple2_1@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<node_k>:
push   %rbx
lea    (%rsi,%rdi,1),%eax
add    $0x3,%eax
add    %edi,%esi
cmovns %esi,%eax
mov    %rdx,%rbx
and    $0xfffffffc,%eax
sub    %eax,%esi
sete   %al
test   %edi,%edi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <Tuple2_1@plt>
mov    %rax,(%rbx)
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.Tuple2_Bool_Int = type { i32 }
define i32 @node_k(i32 %0, i32 %1, %struct.Tuple2_Bool_Int** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.Tuple2_Bool_Int**
%7 = alloca i32
%8 = alloca %struct.Tuple2_Bool_Int*
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.Tuple2_Bool_Int** %2, %struct.Tuple2_Bool_Int*** %6
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = add nsw i32 %10, %11
%13 = srem i32 %12, 4
store i32 %13, i32* %7
%14 = load i32, i32* %7
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %3
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 0
br label %20
20: ; preds = %17, %3
%21 = phi i1 [ false, %3 ], [ %19, %17 ]
%22 = zext i1 %21 to i32
%23 = load i32, i32* %9
%24 = call %struct.Tuple2_Bool_Int* @Tuple2_1(i32 %22, i32 %23)
store %struct.Tuple2_Bool_Int* %24, %struct.Tuple2_Bool_Int** %8
%25 = load %struct.Tuple2_Bool_Int*, %struct.Tuple2_Bool_Int** %8
%26 = load %struct.Tuple2_Bool_Int**, %struct.Tuple2_Bool_Int*** %6
store %struct.Tuple2_Bool_Int* %25, %struct.Tuple2_Bool_Int** %26
ret i32 1
}

LLVM IR (-O2):
%struct.Tuple2_Bool_Int = type { i32 }
define i32 @node_k(i32 %0, i32 %1, %struct.Tuple2_Bool_Int** nocapture writeonly %2) {
%4 = add nsw i32 %1, %0
%5 = srem i32 %4, 4
%6 = icmp eq i32 %5, 0
%7 = icmp ne i32 %0, 0
%8 = and i1 %7, %6
%9 = zext i1 %8 to i32
%10 = tail call %struct.Tuple2_Bool_Int* @Tuple2_1(i32 %9, i32 %5)
store %struct.Tuple2_Bool_Int* %10, %struct.Tuple2_Bool_Int** %2
ret i32 1
}