#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_higher_spec_node(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_spec_nodes() {
  int loc, cc, cc1, cc2, bb;
  int ext, st, anl, tt;
  clear_gset1();
  first_Construct(&loc, &cc);
  while (loc > 0) {
    val_ext(&ext, cc);
    if (ext == 1) {
      val_type(&tt, cc);
      if (1) {
        val_curMRIState(&st, cc);
        val_anl(&anl, st);
        if (anl) {
          cc1 = cc;
          cc2 = 0;
          while (cc2 != -1) {
            get_higher_spec_node(&cc2, cc1);
            if (cc2 != -1) {
              cc1 = cc2;
            }
          }
          member_gset1(&bb, cc1);
          if (bb == 0) {
            add_gset1(&bb, cc1);
            if (!bb) {
              BT_base_err_exit(171);
            };
          }
        }
      }
    }
    next_Construct(&loc, &cc, loc, cc);
  }
}


x86 assembly (clang, -O0):
<load_gset1_top_spec_nodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1070 <clear_gset1@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <first_Construct@plt>
cmpl   $0x0,-0x4(%rbp)
jle    12af <load_gset1_top_spec_nodes+0xff>
mov    -0x8(%rbp),%esi
lea    -0x18(%rbp),%rdi
call   10a0 <val_ext@plt>
cmpl   $0x1,-0x18(%rbp)
jne    1297 <load_gset1_top_spec_nodes+0xe7>
mov    -0x8(%rbp),%esi
lea    -0x24(%rbp),%rdi
call   10b0 <val_type@plt>
mov    -0x8(%rbp),%esi
lea    -0x1c(%rbp),%rdi
call   1050 <val_curMRIState@plt>
mov    -0x1c(%rbp),%esi
lea    -0x20(%rbp),%rdi
call   1060 <val_anl@plt>
cmpl   $0x0,-0x20(%rbp)
je     1292 <load_gset1_top_spec_nodes+0xe2>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
je     1252 <load_gset1_top_spec_nodes+0xa2>
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdi
call   1040 <get_higher_spec_node@plt>
cmpl   $0xffffffff,-0x10(%rbp)
je     124d <load_gset1_top_spec_nodes+0x9d>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1227 <load_gset1_top_spec_nodes+0x77>
mov    -0xc(%rbp),%esi
lea    -0x14(%rbp),%rdi
call   10c0 <member_gset1@plt>
cmpl   $0x0,-0x14(%rbp)
jne    128d <load_gset1_top_spec_nodes+0xdd>
mov    -0xc(%rbp),%esi
lea    -0x14(%rbp),%rdi
call   10d0 <add_gset1@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1288 <load_gset1_top_spec_nodes+0xd8>
mov    $0xab,%edi
call   1090 <BT_base_err_exit@plt>
jmp    128d <load_gset1_top_spec_nodes+0xdd>
jmp    1292 <load_gset1_top_spec_nodes+0xe2>
jmp    1297 <load_gset1_top_spec_nodes+0xe7>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <next_Construct@plt>
jmp    11cc <load_gset1_top_spec_nodes+0x1c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_gset1_top_spec_nodes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
call   1070 <clear_gset1@plt>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1080 <first_Construct@plt>
cmpl   $0x0,0xc(%rsp)
jle    12c5 <load_gset1_top_spec_nodes+0x115>
lea    0x20(%rsp),%r13
lea    0x18(%rsp),%r12
lea    0x14(%rsp),%rbx
lea    0xc(%rsp),%rbp
lea    0x8(%rsp),%r14
jmp    121e <load_gset1_top_spec_nodes+0x6e>
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
call   1030 <next_Construct@plt>
cmpl   $0x0,0xc(%rsp)
jle    12c5 <load_gset1_top_spec_nodes+0x115>
mov    0x8(%rsp),%esi
mov    %r13,%rdi
call   10a0 <val_ext@plt>
cmpl   $0x1,0x20(%rsp)
jne    1200 <load_gset1_top_spec_nodes+0x50>
mov    0x8(%rsp),%esi
lea    0x24(%rsp),%rdi
call   10b0 <val_type@plt>
mov    0x8(%rsp),%esi
lea    0x1c(%rsp),%rdi
call   1050 <val_curMRIState@plt>
mov    0x1c(%rsp),%esi
mov    %r12,%rdi
call   1060 <val_anl@plt>
cmpl   $0x0,0x18(%rsp)
je     1200 <load_gset1_top_spec_nodes+0x50>
mov    0x8(%rsp),%eax
movl   $0x0,0x14(%rsp)
nopl   0x0(%rax)
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <get_higher_spec_node@plt>
mov    0x14(%rsp),%eax
cmp    $0xffffffff,%eax
jne    1270 <load_gset1_top_spec_nodes+0xc0>
lea    0x10(%rsp),%rdi
mov    %r15d,%esi
call   10c0 <member_gset1@plt>
cmpl   $0x0,0x10(%rsp)
jne    1200 <load_gset1_top_spec_nodes+0x50>
lea    0x10(%rsp),%rdi
mov    %r15d,%esi
call   10d0 <add_gset1@plt>
cmpl   $0x0,0x10(%rsp)
jne    1200 <load_gset1_top_spec_nodes+0x50>
mov    $0xab,%edi
call   1090 <BT_base_err_exit@plt>
jmp    1200 <load_gset1_top_spec_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_spec_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 = %57, %0
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %61
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, 1
br i1 %19, label %20, label %57
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 %56
29: ; preds = %20
%30 = load i32, i32* %2
store i32 %30, i32* %3
store i32 0, i32* %4
br label %31
31: ; preds = %41, %29
%32 = load i32, i32* %4
%33 = icmp ne i32 %32, -1
br i1 %33, label %34, label %42
34: ; preds = %31
%35 = load i32, i32* %3
%36 = call i32 @get_higher_spec_node(i32* %4, i32 %35)
%37 = load i32, i32* %4
%38 = icmp ne i32 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = load i32, i32* %4
store i32 %40, i32* %3
br label %41
41: ; preds = %39, %34
br label %31
42: ; preds = %31
%43 = load i32, i32* %3
%44 = call i32 @member_gset1(i32* %5, i32 %43)
%45 = load i32, i32* %5
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %55
47: ; preds = %42
%48 = load i32, i32* %3
%49 = call i32 @add_gset1(i32* %5, i32 %48)
%50 = load i32, i32* %5
%51 = icmp ne i32 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %47
%53 = call i32 @BT_base_err_exit(i32 171)
br label %54
54: ; preds = %52, %47
br label %55
55: ; preds = %54, %42
br label %56
56: ; preds = %55, %20
br label %57
57: ; preds = %56, %15
%58 = load i32, i32* %1
%59 = load i32, i32* %2
%60 = call i32 @next_Construct(i32* %1, i32* %2, i32 %58, i32 %59)
br label %12
61: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @load_gset1_top_spec_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 = bitcast i32* %1 to i8*
%10 = bitcast i32* %2 to i8*
%11 = bitcast i32* %3 to i8*
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = tail call i32 (...) @clear_gset1()
%18 = call i32 @first_Construct(i32* %1, i32* %2)
%19 = load i32, i32* %1
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %58
21: ; preds = %0, %52
%22 = load i32, i32* %2
%23 = call i32 @val_ext(i32* %5, i32 %22)
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %52
26: ; preds = %21
%27 = load i32, i32* %2
%28 = call i32 @val_type(i32* %8, i32 %27)
%29 = load i32, i32* %2
%30 = call i32 @val_curMRIState(i32* %6, i32 %29)
%31 = load i32, i32* %6
%32 = call i32 @val_anl(i32* %7, i32 %31)
%33 = load i32, i32* %7
%34 = icmp eq i32 %33, 0
br i1 %34, label %52, label %35
35: ; preds = %26
%36 = load i32, i32* %2
store i32 0, i32* %3
br label %37
37: ; preds = %35, %37
%38 = phi i32 [ %36, %35 ], [ %40, %37 ]
%39 = call i32 @get_higher_spec_node(i32* %3, i32 %38)
%40 = load i32, i32* %3
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %37
42: ; preds = %37
%43 = call i32 @member_gset1(i32* %4, i32 %38)
%44 = load i32, i32* %4
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %42
%47 = call i32 @add_gset1(i32* %4, i32 %38)
%48 = load i32, i32* %4
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 @BT_base_err_exit(i32 171)
br label %52
52: ; preds = %26, %46, %50, %42, %21
%53 = load i32, i32* %1
%54 = load i32, i32* %2
%55 = call i32 @next_Construct(i32* %1, i32* %2, i32 %53, i32 %54)
%56 = load i32, i32* %1
%57 = icmp sgt i32 %56, 0
br i1 %57, label %21, label %58
58: ; preds = %52, %0
ret void
}