// File: /workspace/github_c_makefile_star2_O3/beejjorgensen[P]conquest/conqsubs.c
// Function: research
void research(int team, char field, int amt)
{
    switch (field) {
    case 'W':
        if (weapons[team] < 10) {
            weap_working[team] = weap_working[team] + amt;
            amt = 0;
            if (weap_working[team] >= weap_req[weapons[team] + 1]) {
                amt = weap_working[team]
                    - weap_req[weapons[team] + 1];
                weapons[team] = weapons[team] + 1;
                if (team == ENEMY) {
                    new_research();
                    field = en_research;
                };
                weap_working[team] = 0;
                research(team, field, amt);
            };
        };
        break;
    case 'R':
        if (range[team] < bdsize) {
            ran_working[team] = ran_working[team] + amt;
            amt = 0;
            if (ran_working[team] >= ran_req[range[team] + 1]) {
                amt = ran_working[team]
                    - ran_req[range[team] + 1];
                range[team] = range[team] + 1;
                if (team == ENEMY) {
                    new_research();
                    field = en_research;
                };
                ran_working[team] = 0;
                research(team, field, amt);
            };
        };
        break;
    case 'V':
        if (vel[team] < max_vel) {
            vel_working[team] = vel_working[team] + amt;
            amt = 0;
            if (vel_working[team] >= vel_req[vel[team] + 1]) {
                amt = vel_working[team] - vel_req[vel[team] + 1];
                vel[team] = vel[team] + 1;
                if (team == ENEMY) {
                    new_research();
                    field = en_research;
                };
                vel_working[team] = 0;
                research(team, field, amt);
            };
        };
        break;
    default:
        printw("error!!!! in research field %c\n", field);
    };                          /*switch ( */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
leaq 0x7a5f(%rip), %r9       # 0xf6d0
leaq 0x7a50(%rip), %r8       # 0xf6c8
leaq 0x7a41(%rip), %r10      # 0xf6c0
movl $0x31, %edx
leaq 0x7a25(%rip), %r13      # 0xf6b0
leaq 0x7a7e(%rip), %r11      # 0xf710
leaq 0x7a1f(%rip), %r15      # 0xf6b8
leaq 0x7a40(%rip), %r14      # 0xf6e0
leaq 0x7a01(%rip), %rbp      # 0xf6a8
movzbl %sil, %eax
leal -0x52(%rax), %ecx
cmpl $0x5, %ecx
ja 0x7ddd
btl %ecx, %edx
jae 0x7ddd
movslq %edi, %rdx
leaq (,%rdx,4), %rcx
leaq (%rcx,%r9), %rdi
leaq (%rcx,%r8), %r12
addq %r10, %rcx
leaq 0x7a73(%rip), %r10      # 0xf750
cmpb $0x52, %sil
je 0x7d15
cmpl $0x57, %eax
jne 0x7d48
movslq (%r15,%rdx,4), %r8
cmpq $0x9, %r8
jg 0x7dce
addl (%rcx), %ebx
movl %ebx, (%rcx)
subl 0x4(%r14,%r8,4), %ebx
jl 0x7dce
incq %r8
movl %r8d, (%r15,%rdx,4)
movq %rcx, %r8
testl %edx, %edx
jne 0x7d6d
jmp 0x7d7e
movslq (%r13,%rdx,4), %r8
cmpq $0xe, %r8
jg 0x7dce
addl (%r12), %ebx
movl %ebx, (%r12)
subl 0x4(%r11,%r8,4), %ebx
jl 0x7dce
incq %r8
movl %r8d, (%r13,%rdx,4)
movq %r12, %r8
testl %edx, %edx
jne 0x7d6d
jmp 0x7d79
movslq (%rbp,%rdx,4), %r8
cmpq $0xb, %r8
jg 0x7dce
addl (%rdi), %ebx
movl %ebx, (%rdi)
subl 0x4(%r10,%r8,4), %ebx
jl 0x7dce
incq %r8
movl %r8d, (%rbp,%rdx,4)
movq %rdi, %r8
testl %edx, %edx
je 0x7d86
movl $0x0, (%r8)
jmp 0x7cdd
movq %r9, %r14
jmp 0x7d8c
movq %r9, %r14
movq %rcx, %r12
jmp 0x7d8c
movq %r9, %r14
movq %rdi, %r12
callq 0x2c14
leaq 0x5fe8(%rip), %rax      # 0xdd80
movb (%rax), %sil
movl $0x0, (%r12)
xorl %edi, %edi
movq %r14, %r9
leaq 0x7919(%rip), %r8       # 0xf6c8
leaq 0x790a(%rip), %r10      # 0xf6c0
movl $0x31, %edx
leaq 0x794e(%rip), %r11      # 0xf710
leaq 0x7917(%rip), %r14      # 0xf6e0
jmp 0x7ca7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsbl %sil, %esi
leaq 0x214d(%rip), %rdi      # 0x9f35
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030
nopl (%rax)