#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 */

/* Variables and functions */
int /*<<< orphan*/ BT_base_err_exit(int);
int /*<<< orphan*/ add_gset1(int *, int);
int /*<<< orphan*/ clear_gset1();
int /*<<< orphan*/ first_Construct(int *, int *);
int /*<<< orphan*/ get_botref(int *, int);
int /*<<< orphan*/ get_higher_imp_node(int *, int);
int /*<<< orphan*/ get_topabs(int *, int);
int /*<<< orphan*/ member_gset1(int *, int);
int /*<<< orphan*/ next_Construct(int *, int *, int, int);
int /*<<< orphan*/ val_anl(int *, int);
int /*<<< orphan*/ val_curMRIState(int *, int);
int /*<<< orphan*/ val_ext(int *, int);
int /*<<< orphan*/ val_type(int *, int);
void load_gset1_top_imp_nodes() {
  int loc, cc, cc2, cc1, bb;
  int ext, st, anl, tt;
  clear_gset1();
  first_Construct(&loc, &cc);
  while (loc > 0) {
    val_ext(&ext, cc);
    if (ext == 3) {
      val_type(&tt, cc);
      if (1) {
        val_curMRIState(&st, cc);
        val_anl(&anl, st);
        if (anl) {
          get_topabs(&cc1, cc);
          cc2 = 0;
          while (cc2 != -1) {
            get_higher_imp_node(&cc2, cc1);
            if (cc2 != -1) {
              get_topabs(&cc1, cc2);
            }
          }
          get_botref(&cc2, cc1);
          member_gset1(&bb, cc2);
          if (bb == 0) {
            add_gset1(&bb, cc2);
            if (!bb) {
              BT_base_err_exit(170);
            };
          }
        }
      }
    }
    next_Construct(&loc, &cc, loc, cc);
  }
}


x86 assembly (clang, -O0):
<load_gset1_top_imp_nodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1060 <clear_gset1@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <first_Construct@plt>
cmpl   $0x0,-0x4(%rbp)
jle    12e7 <load_gset1_top_imp_nodes+0x117>
mov    -0x8(%rbp),%esi
lea    -0x18(%rbp),%rdi
call   10a0 <val_ext@plt>
cmpl   $0x3,-0x18(%rbp)
jne    12cf <load_gset1_top_imp_nodes+0xff>
mov    -0x8(%rbp),%esi
lea    -0x24(%rbp),%rdi
call   10c0 <val_type@plt>
mov    -0x8(%rbp),%esi
lea    -0x1c(%rbp),%rdi
call   1040 <val_curMRIState@plt>
mov    -0x1c(%rbp),%esi
lea    -0x20(%rbp),%rdi
call   1050 <val_anl@plt>
cmpl   $0x0,-0x20(%rbp)
je     12ca <load_gset1_top_imp_nodes+0xfa>
mov    -0x8(%rbp),%esi
lea    -0x10(%rbp),%rdi
call   1070 <get_topabs@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     127e <load_gset1_top_imp_nodes+0xae>
mov    -0x10(%rbp),%esi
lea    -0xc(%rbp),%rdi
call   10f0 <get_higher_imp_node@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     1279 <load_gset1_top_imp_nodes+0xa9>
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdi
call   1070 <get_topabs@plt>
jmp    124d <load_gset1_top_imp_nodes+0x7d>
mov    -0x10(%rbp),%esi
lea    -0xc(%rbp),%rdi
call   10b0 <get_botref@plt>
mov    -0xc(%rbp),%esi
lea    -0x14(%rbp),%rdi
call   10d0 <member_gset1@plt>
cmpl   $0x0,-0x14(%rbp)
jne    12c5 <load_gset1_top_imp_nodes+0xf5>
mov    -0xc(%rbp),%esi
lea    -0x14(%rbp),%rdi
call   10e0 <add_gset1@plt>
cmpl   $0x0,-0x14(%rbp)
jne    12c0 <load_gset1_top_imp_nodes+0xf0>
mov    $0xaa,%edi
call   1090 <BT_base_err_exit@plt>
jmp    12c5 <load_gset1_top_imp_nodes+0xf5>
jmp    12ca <load_gset1_top_imp_nodes+0xfa>
jmp    12cf <load_gset1_top_imp_nodes+0xff>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <next_Construct@plt>
jmp    11ec <load_gset1_top_imp_nodes+0x1c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_gset1_top_imp_nodes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
call   1060 <clear_gset1@plt>
lea    0xc(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1080 <first_Construct@plt>
cmpl   $0x0,0xc(%rsp)
jle    1311 <load_gset1_top_imp_nodes+0x141>
lea    0x20(%rsp),%r13
lea    0x18(%rsp),%r12
lea    0x14(%rsp),%rbx
lea    0x8(%rsp),%rbp
lea    0xc(%rsp),%r14
lea    0x4(%rsp),%r15
jmp    123e <load_gset1_top_imp_nodes+0x6e>
nop
mov    0xc(%rsp),%edx
mov    0x4(%rsp),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <next_Construct@plt>
cmpl   $0x0,0xc(%rsp)
jle    1311 <load_gset1_top_imp_nodes+0x141>
mov    0x4(%rsp),%esi
mov    %r13,%rdi
call   10a0 <val_ext@plt>
cmpl   $0x3,0x20(%rsp)
jne    1220 <load_gset1_top_imp_nodes+0x50>
mov    0x4(%rsp),%esi
lea    0x24(%rsp),%rdi
call   10c0 <val_type@plt>
mov    0x4(%rsp),%esi
lea    0x1c(%rsp),%rdi
call   1040 <val_curMRIState@plt>
mov    0x1c(%rsp),%esi
mov    %r12,%rdi
call   1050 <val_anl@plt>
cmpl   $0x0,0x18(%rsp)
je     1220 <load_gset1_top_imp_nodes+0x50>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1070 <get_topabs@plt>
movl   $0x0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x14(%rsp),%esi
mov    %rbp,%rdi
call   10f0 <get_higher_imp_node@plt>
mov    0x8(%rsp),%esi
cmp    $0xffffffff,%esi
je     12c4 <load_gset1_top_imp_nodes+0xf4>
mov    %rbx,%rdi
call   1070 <get_topabs@plt>
cmpl   $0xffffffff,0x8(%rsp)
jne    12a0 <load_gset1_top_imp_nodes+0xd0>
mov    0x14(%rsp),%esi
mov    %rbp,%rdi
call   10b0 <get_botref@plt>
mov    0x8(%rsp),%esi
lea    0x10(%rsp),%rdi
call   10d0 <member_gset1@plt>
cmpl   $0x0,0x10(%rsp)
jne    1220 <load_gset1_top_imp_nodes+0x50>
mov    0x8(%rsp),%esi
lea    0x10(%rsp),%rdi
call   10e0 <add_gset1@plt>
cmpl   $0x0,0x10(%rsp)
jne    1220 <load_gset1_top_imp_nodes+0x50>
mov    $0xaa,%edi
call   1090 <BT_base_err_exit@plt>
jmp    1220 <load_gset1_top_imp_nodes+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @load_gset1_top_imp_nodes() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = call i32 (...) @clear_gset1()
%11 = call i32 @first_Construct(i32* %1, i32* %2)
br label %12
12: ; preds = %61, %0
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %65
15: ; preds = %12
%16 = load i32, i32* %2
%17 = call i32 @val_ext(i32* %6, i32 %16)
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %61
20: ; preds = %15
%21 = load i32, i32* %2
%22 = call i32 @val_type(i32* %9, i32 %21)
%23 = load i32, i32* %2
%24 = call i32 @val_curMRIState(i32* %7, i32 %23)
%25 = load i32, i32* %7
%26 = call i32 @val_anl(i32* %8, i32 %25)
%27 = load i32, i32* %8
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %60
29: ; preds = %20
%30 = load i32, i32* %2
%31 = call i32 @get_topabs(i32* %4, i32 %30)
store i32 0, i32* %3
br label %32
32: ; preds = %43, %29
%33 = load i32, i32* %3
%34 = icmp ne i32 %33, -1
br i1 %34, label %35, label %44
35: ; preds = %32
%36 = load i32, i32* %4
%37 = call i32 @get_higher_imp_node(i32* %3, i32 %36)
%38 = load i32, i32* %3
%39 = icmp ne i32 %38, -1
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = load i32, i32* %3
%42 = call i32 @get_topabs(i32* %4, i32 %41)
br label %43
43: ; preds = %40, %35
br label %32
44: ; preds = %32
%45 = load i32, i32* %4
%46 = call i32 @get_botref(i32* %3, i32 %45)
%47 = load i32, i32* %3
%48 = call i32 @member_gset1(i32* %5, i32 %47)
%49 = load i32, i32* %5
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %59
51: ; preds = %44
%52 = load i32, i32* %3
%53 = call i32 @add_gset1(i32* %5, i32 %52)
%54 = load i32, i32* %5
%55 = icmp ne i32 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %51
%57 = call i32 @BT_base_err_exit(i32 170)
br label %58
58: ; preds = %56, %51
br label %59
59: ; preds = %58, %44
br label %60
60: ; preds = %59, %20
br label %61
61: ; preds = %60, %15
%62 = load i32, i32* %1
%63 = load i32, i32* %2
%64 = call i32 @next_Construct(i32* %1, i32* %2, i32 %62, i32 %63)
br label %12
65: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @load_gset1_top_imp_nodes() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = bitcast i32* %1 to i8*
%11 = bitcast i32* %2 to i8*
%12 = bitcast i32* %3 to i8*
%13 = bitcast i32* %4 to i8*
%14 = bitcast i32* %5 to i8*
%15 = bitcast i32* %6 to i8*
%16 = bitcast i32* %7 to i8*
%17 = bitcast i32* %8 to i8*
%18 = bitcast i32* %9 to i8*
%19 = tail call i32 (...) @clear_gset1()
%20 = call i32 @first_Construct(i32* %1, i32* %2)
%21 = load i32, i32* %1
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %69
23: ; preds = %0, %63
%24 = load i32, i32* %2
%25 = call i32 @val_ext(i32* %6, i32 %24)
%26 = load i32, i32* %6
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %63
28: ; preds = %23
%29 = load i32, i32* %2
%30 = call i32 @val_type(i32* %9, i32 %29)
%31 = load i32, i32* %2
%32 = call i32 @val_curMRIState(i32* %7, i32 %31)
%33 = load i32, i32* %7
%34 = call i32 @val_anl(i32* %8, i32 %33)
%35 = load i32, i32* %8
%36 = icmp eq i32 %35, 0
br i1 %36, label %63, label %37
37: ; preds = %28
%38 = load i32, i32* %2
%39 = call i32 @get_topabs(i32* %4, i32 %38)
store i32 0, i32* %3
br label %40
40: ; preds = %37, %45
%41 = load i32, i32* %4
%42 = call i32 @get_higher_imp_node(i32* %3, i32 %41)
%43 = load i32, i32* %3
%44 = icmp eq i32 %43, -1
br i1 %44, label %49, label %45
45: ; preds = %40
%46 = call i32 @get_topabs(i32* %4, i32 %43)
%47 = load i32, i32* %3
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %40
49: ; preds = %40, %45
%50 = load i32, i32* %4
%51 = call i32 @get_botref(i32* %3, i32 %50)
%52 = load i32, i32* %3
%53 = call i32 @member_gset1(i32* %5, i32 %52)
%54 = load i32, i32* %5
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %63
56: ; preds = %49
%57 = load i32, i32* %3
%58 = call i32 @add_gset1(i32* %5, i32 %57)
%59 = load i32, i32* %5
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %56
%62 = call i32 @BT_base_err_exit(i32 170)
br label %63
63: ; preds = %28, %56, %61, %49, %23
%64 = load i32, i32* %1
%65 = load i32, i32* %2
%66 = call i32 @next_Construct(i32* %1, i32* %2, i32 %64, i32 %65)
%67 = load i32, i32* %1
%68 = icmp sgt i32 %67, 0
br i1 %68, label %23, label %69
69: ; preds = %63, %0
ret void
}