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

/* Variables and functions */
struct Tuple3_Bool_Bool_Bool *Tuple3_1(int, int, int);
scalar_t__ editable_0(int);
int node_anonymous69880541228320(int curMode, int flash, int curPos,
                                 struct Tuple3_Bool_Bool_Bool **output) {
  int _tmp009;
  struct Tuple3_Bool_Bool_Bool *_tmp008;
  _tmp009 = (editable_0(curMode) && flash);
  if (_tmp009 == 1) {
    struct Tuple3_Bool_Bool_Bool *_tmp010;
    if (curPos == 0) {
      _tmp010 = Tuple3_1(1, 0, 0);
    } else if (curPos == 1) {
      _tmp010 = Tuple3_1(0, 1, 0);
    } else if (curPos == 2) {
      _tmp010 = Tuple3_1(0, 0, 1);
    }
    _tmp008 = _tmp010;
  } else if (_tmp009 == 0) {
    _tmp008 = Tuple3_1(0, 0, 0);
  }
  *output = _tmp008;
  return 1;
}


x86 assembly (clang, -O0):
<node_anonymous69880541228320>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <editable_0@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x31(%rbp)
je     1159 <node_anonymous69880541228320+0x39>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    11e3 <node_anonymous69880541228320+0xc3>
cmpl   $0x0,-0xc(%rbp)
jne    118f <node_anonymous69880541228320+0x6f>
mov    $0x1,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <Tuple3_1@plt>
mov    %rax,-0x30(%rbp)
jmp    11d6 <node_anonymous69880541228320+0xb6>
cmpl   $0x1,-0xc(%rbp)
jne    11b0 <node_anonymous69880541228320+0x90>
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1040 <Tuple3_1@plt>
mov    %rax,-0x30(%rbp)
jmp    11d1 <node_anonymous69880541228320+0xb1>
cmpl   $0x2,-0xc(%rbp)
jne    11cc <node_anonymous69880541228320+0xac>
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1040 <Tuple3_1@plt>
mov    %rax,-0x30(%rbp)
jmp    11d1 <node_anonymous69880541228320+0xb1>
jmp    11d6 <node_anonymous69880541228320+0xb6>
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1201 <node_anonymous69880541228320+0xe1>
cmpl   $0x0,-0x1c(%rbp)
jne    11fc <node_anonymous69880541228320+0xdc>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1040 <Tuple3_1@plt>
mov    %rax,-0x28(%rbp)
jmp    1201 <node_anonymous69880541228320+0xe1>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<node_anonymous69880541228320>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %edx,%ebp
mov    %esi,%ebx
call   1030 <editable_0@plt>
test   %ebx,%ebx
je     114e <node_anonymous69880541228320+0x2e>
test   %rax,%rax
je     114e <node_anonymous69880541228320+0x2e>
cmp    $0x2,%ebp
je     1166 <node_anonymous69880541228320+0x46>
cmp    $0x1,%ebp
je     1171 <node_anonymous69880541228320+0x51>
test   %ebp,%ebp
jne    1159 <node_anonymous69880541228320+0x39>
mov    $0x1,%edi
jmp    1150 <node_anonymous69880541228320+0x30>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <Tuple3_1@plt>
mov    %rax,(%r14)
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
jmp    1154 <node_anonymous69880541228320+0x34>
xor    %edi,%edi
mov    $0x1,%esi
jmp    1152 <node_anonymous69880541228320+0x32>

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

LLVM IR (-O2):
%struct.Tuple3_Bool_Bool_Bool = type { i32 }
define i32 @node_anonymous69880541228320(i32 %0, i32 %1, i32 %2, %struct.Tuple3_Bool_Bool_Bool** nocapture writeonly %3) {
%5 = tail call i64 @editable_0(i32 %0)
%6 = icmp ne i64 %5, 0
%7 = icmp ne i32 %1, 0
%8 = and i1 %7, %6
br i1 %8, label %9, label %16
9: ; preds = %4
switch i32 %2, label %18 [
i32 0, label %10
i32 1, label %12
i32 2, label %14
]
10: ; preds = %9
%11 = tail call %struct.Tuple3_Bool_Bool_Bool* @Tuple3_1(i32 1, i32 0, i32 0)
br label %18
12: ; preds = %9
%13 = tail call %struct.Tuple3_Bool_Bool_Bool* @Tuple3_1(i32 0, i32 1, i32 0)
br label %18
14: ; preds = %9
%15 = tail call %struct.Tuple3_Bool_Bool_Bool* @Tuple3_1(i32 0, i32 0, i32 1)
br label %18
16: ; preds = %4
%17 = tail call %struct.Tuple3_Bool_Bool_Bool* @Tuple3_1(i32 0, i32 0, i32 0)
br label %18
18: ; preds = %10, %14, %12, %9, %16
%19 = phi %struct.Tuple3_Bool_Bool_Bool* [ %17, %16 ], [ %11, %10 ], [ %13, %12 ], [ %15, %14 ], [ undef, %9 ]
store %struct.Tuple3_Bool_Bool_Bool* %19, %struct.Tuple3_Bool_Bool_Bool** %3
ret i32 1
}