// File: /workspace/github_c_makefile_star2_O0/6851-2021[P]euler_tour_tree/euler_tour_tree_test.c
// Function: main
int main() {
    int n = 10000;
    EulerTourTree* tree = make_euler_tour_tree(n);
    EulerTourTreeTest* tree_test = make_euler_tour_tree_test(n);
    srand(32492341);
    for (int i = 0; i < 1000; i++) {
        int op = rand() % 9;

        if (op > 5) {
            op = 1;
        }

        // scanf("%d\n", &op);
        if (op == 0) {
            for (int i = 0; i < n; i++) {
                assert(find_root(tree, i) == find_root_test(tree_test, i));
            }
        } else if (op == 1) {
            int i = rand() % n;
            for (int j = 0; j < n; j++) {
                if ((j+i)%n != 0 && tree_test->parent[(j+i)%n] == -1) {
                    k_t par = rand() % ((j+i)%n);
                    link(tree, (j+i)%n, par);
                    link_test(tree_test, (j+i)%n, par);
                    break;
                }
            }
        } else if (op == 2) {
            int i = rand() % n;
            for (int j = 0; j < n; j++) {
                if (tree_test->parent[(j+i)%n] != -1) {
                    cut(tree, (j+i)%n);
                    cut_test(tree_test, (j+i)%n);
                    break;
                }
            }
        } else if (op == 3) {
            for (int i = 0; i < n; i++) {
                assert(subtree_aggregate_min(tree, i) == subtree_aggregate_min_test(tree_test, i));
                assert(subtree_aggregate_max(tree, i) == subtree_aggregate_max_test(tree_test, i));
                assert(subtree_aggregate_sum(tree, i) == subtree_aggregate_sum_test(tree_test, i));
                assert(subtree_aggregate_size(tree, i) == subtree_aggregate_size_test(tree_test, i));
            }
        } else if (op == 4) {
            int v = rand() % n;
            int val = rand() % 1000000;
            point_update(tree, v, val);
            point_update_test(tree_test, v, val);
        } else if (op == 5) {
            int v = rand() % n;
            int val = rand() % 100000;
            subtree_update(tree, v, val);
            subtree_update_test(tree_test, v, val);
        }
    }
}

// Assembly:
subq $0x98, %rsp
movl $0x0, 0x94(%rsp)
movl $0x2710, 0x90(%rsp) # imm = 0x2710
movslq 0x90(%rsp), %rdi
callq 0x1cc0
movq %rax, 0x88(%rsp)
movslq 0x90(%rsp), %rdi
callq 0x2650
movq %rax, 0x80(%rsp)
movl $0x1efcb35, %edi        # imm = 0x1EFCB35
callq 0x1060
movl $0x0, 0x7c(%rsp)
cmpl $0x3e8, 0x7c(%rsp)      # imm = 0x3E8
jge 0x30da
callq 0x10a0
movl $0x9, %ecx
cltd
idivl %ecx
movl %edx, 0x78(%rsp)
cmpl $0x5, 0x78(%rsp)
jle 0x2c27
movl $0x1, 0x78(%rsp)
cmpl $0x0, 0x78(%rsp)
jne 0x2cb2
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
cmpl 0x90(%rsp), %eax
jge 0x2cad
movq 0x88(%rsp), %rdi
movslq 0x74(%rsp), %rsi
callq 0x1f60
movq %rax, 0x38(%rsp)
movq 0x80(%rsp), %rdi
movslq 0x74(%rsp), %rsi
callq 0x2750
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
jne 0x2c7f
jmp 0x2c9e
leaq 0x13a0(%rip), %rdi      # 0x4026
leaq 0x13cc(%rip), %rsi      # 0x4059
movl $0x88, %edx
leaq 0x13d7(%rip), %rcx      # 0x4070
callq 0x1050
jmp 0x2ca0
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x2c3a
jmp 0x30c8
cmpl $0x1, 0x78(%rsp)
jne 0x2dbc
callq 0x10a0
cltd
idivl 0x90(%rsp)
movl %edx, 0x70(%rsp)
movl $0x0, 0x6c(%rsp)
movl 0x6c(%rsp), %eax
cmpl 0x90(%rsp), %eax
jge 0x2db7
movl 0x6c(%rsp), %eax
addl 0x70(%rsp), %eax
cltd
idivl 0x90(%rsp)
cmpl $0x0, %edx
je 0x2da5
movq 0x80(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movl 0x6c(%rsp), %eax
addl 0x70(%rsp), %eax
cltd
idivl 0x90(%rsp)
movq 0x30(%rsp), %rax
movslq %edx, %rcx
cmpq $-0x1, (%rax,%rcx,8)
jne 0x2da5
callq 0x10a0
movl %eax, 0x2c(%rsp)
movl 0x6c(%rsp), %eax
addl 0x70(%rsp), %eax
cltd
idivl 0x90(%rsp)
movl 0x2c(%rsp), %eax
movl %edx, %ecx
cltd
idivl %ecx
movslq %edx, %rax
movq %rax, 0x60(%rsp)
movq 0x88(%rsp), %rdi
movl 0x6c(%rsp), %eax
addl 0x70(%rsp), %eax
cltd
idivl 0x90(%rsp)
movslq %edx, %rsi
movq 0x60(%rsp), %rdx
callq 0x2130
movq 0x80(%rsp), %rdi
movl 0x6c(%rsp), %eax
addl 0x70(%rsp), %eax
cltd
idivl 0x90(%rsp)
movslq %edx, %rsi
movq 0x60(%rsp), %rdx
callq 0x27b0
jmp 0x2db7
jmp 0x2da7
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0x2cd6
jmp 0x30c6
cmpl $0x2, 0x78(%rsp)
jne 0x2e79
callq 0x10a0
cltd
idivl 0x90(%rsp)
movl %edx, 0x5c(%rsp)
movl $0x0, 0x58(%rsp)
movl 0x58(%rsp), %eax
cmpl 0x90(%rsp), %eax
jge 0x2e74
movq 0x80(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movl 0x58(%rsp), %eax
addl 0x5c(%rsp), %eax
cltd
idivl 0x90(%rsp)
movq 0x20(%rsp), %rax
movslq %edx, %rcx
cmpq $-0x1, (%rax,%rcx,8)
je 0x2e62
movq 0x88(%rsp), %rdi
movl 0x58(%rsp), %eax
addl 0x5c(%rsp), %eax
cltd
idivl 0x90(%rsp)
movslq %edx, %rsi
callq 0x1fe0
movq 0x80(%rsp), %rdi
movl 0x58(%rsp), %eax
addl 0x5c(%rsp), %eax
cltd
idivl 0x90(%rsp)
movslq %edx, %rsi
callq 0x2790
jmp 0x2e74
jmp 0x2e64
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
jmp 0x2de0
jmp 0x30c4
cmpl $0x3, 0x78(%rsp)
jne 0x300e
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
cmpl 0x90(%rsp), %eax
jge 0x3009
movq 0x88(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x2490
movq %rax, 0x18(%rsp)
movq 0x80(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x28f0
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jne 0x2ed5
jmp 0x2ef4
leaq 0x119f(%rip), %rdi      # 0x407b
leaq 0x1176(%rip), %rsi      # 0x4059
movl $0x9f, %edx
leaq 0x1181(%rip), %rcx      # 0x4070
callq 0x1050
movq 0x88(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x2500
movq %rax, 0x10(%rsp)
movq 0x80(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x29c0
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jne 0x2f2c
jmp 0x2f4b
leaq 0x1193(%rip), %rdi      # 0x40c6
leaq 0x111f(%rip), %rsi      # 0x4059
movl $0xa0, %edx
leaq 0x112a(%rip), %rcx      # 0x4070
callq 0x1050
movq 0x88(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x2570
movq %rax, 0x8(%rsp)
movq 0x80(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x2a90
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jne 0x2f83
jmp 0x2fa2
leaq 0x1187(%rip), %rdi      # 0x4111
leaq 0x10c8(%rip), %rsi      # 0x4059
movl $0xa1, %edx
leaq 0x10d3(%rip), %rcx      # 0x4070
callq 0x1050
movq 0x88(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x25e0
movq %rax, (%rsp)
movq 0x80(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x2b20
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jne 0x2fd8
jmp 0x2ff7
leaq 0x117d(%rip), %rdi      # 0x415c
leaq 0x1073(%rip), %rsi      # 0x4059
movl $0xa2, %edx
leaq 0x107e(%rip), %rcx      # 0x4070
callq 0x1050
jmp 0x2ff9
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x2e8c
jmp 0x30c2
cmpl $0x4, 0x78(%rsp)
jne 0x3067
callq 0x10a0
cltd
idivl 0x90(%rsp)
movl %edx, 0x50(%rsp)
callq 0x10a0
movl $0xf4240, %ecx          # imm = 0xF4240
cltd
idivl %ecx
movl %edx, 0x4c(%rsp)
movq 0x88(%rsp), %rdi
movslq 0x50(%rsp), %rsi
movslq 0x4c(%rsp), %rdx
callq 0x23e0
movq 0x80(%rsp), %rdi
movslq 0x50(%rsp), %rsi
movslq 0x4c(%rsp), %rdx
callq 0x2830
jmp 0x30c0
cmpl $0x5, 0x78(%rsp)
jne 0x30be
callq 0x10a0
cltd
idivl 0x90(%rsp)
movl %edx, 0x48(%rsp)
callq 0x10a0
movl $0x186a0, %ecx          # imm = 0x186A0
cltd
idivl %ecx
movl %edx, 0x44(%rsp)
movq 0x88(%rsp), %rdi
movslq 0x48(%rsp), %rsi
movslq 0x44(%rsp), %rdx
callq 0x2420
movq 0x80(%rsp), %rdi
movslq 0x48(%rsp), %rsi
movslq 0x44(%rsp), %rdx
callq 0x2860
jmp 0x30c0
jmp 0x30c2
jmp 0x30c4
jmp 0x30c6
jmp 0x30c8
jmp 0x30ca
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x2bf9
movl 0x94(%rsp), %eax
addq $0x98, %rsp
retq