// File: /workspace/github_c_makefile_star2_O1/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
movslq %edi, %r14
leaq 0x79e0(%rip), %rcx      # 0xf6c0
leaq 0x79f1(%rip), %r12      # 0xf6d8
leaq 0x79ca(%rip), %rdi      # 0xf6b8
leaq 0x79eb(%rip), %rbp      # 0xf6e0
leaq 0x79cc(%rip), %r15      # 0xf6c8
leaq 0x79cd(%rip), %r13      # 0xf6d0
cmpb $0x52, %sil
je 0x7ddc
movzbl %sil, %eax
cmpl $0x56, %eax
je 0x7d7c
cmpl $0x57, %eax
jne 0x7e40
movslq (%r15,%r14,4), %rax
cmpq $0x9, %rax
jg 0x7e31
addl (%r13,%r14,4), %ebx
movl %ebx, (%r13,%r14,4)
leaq 0x79b2(%rip), %rdx      # 0xf6f0
subl 0x4(%rdx,%rax,4), %ebx
jl 0x7e31
incq %rax
movl %eax, (%r15,%r14,4)
testl %r14d, %r14d
jne 0x7d71
callq 0x2b74
leaq 0x7958(%rip), %rdi      # 0xf6b8
leaq 0x7959(%rip), %rcx      # 0xf6c0
leaq 0x6022(%rip), %rax      # 0xdd90
movb (%rax), %sil
movl $0x0, (%r13,%r14,4)
jmp 0x7d03
movslq (%rdi,%r14,4), %rax
cmpq $0xb, %rax
jg 0x7e31
addl (%rbp,%r14,4), %ebx
movl %ebx, (%rbp,%r14,4)
leaq 0x79c5(%rip), %rdx      # 0xf760
subl 0x4(%rdx,%rax,4), %ebx
jl 0x7e31
incq %rax
movl %eax, (%rdi,%r14,4)
testl %r14d, %r14d
jne 0x7dce
callq 0x2b74
leaq 0x78fb(%rip), %rdi      # 0xf6b8
leaq 0x78fc(%rip), %rcx      # 0xf6c0
leaq 0x5fc5(%rip), %rax      # 0xdd90
movb (%rax), %sil
movl $0x0, (%rbp,%r14,4)
jmp 0x7d03
movslq (%rcx,%r14,4), %rax
cmpq $0xe, %rax
jg 0x7e31
addl (%r12,%r14,4), %ebx
movl %ebx, (%r12,%r14,4)
leaq 0x792b(%rip), %rdx      # 0xf720
subl 0x4(%rdx,%rax,4), %ebx
jl 0x7e31
incq %rax
movl %eax, (%rcx,%r14,4)
testl %r14d, %r14d
jne 0x7e24
callq 0x2b74
leaq 0x78a5(%rip), %rdi      # 0xf6b8
leaq 0x78a6(%rip), %rcx      # 0xf6c0
leaq 0x5f6f(%rip), %rax      # 0xdd90
movb (%rax), %sil
movl $0x0, (%r12,%r14,4)
jmp 0x7d03
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsbl %sil, %esi
leaq 0x209a(%rip), %rdi      # 0x9ee5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030