// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movb %sil, %al
movl %edi, -0x4(%rbp)
movb %al, -0x5(%rbp)
movl %edx, -0xc(%rbp)
movsbl -0x5(%rbp), %eax
movl %eax, -0x10(%rbp)
subl $0x52, %eax
je 0xb7ae
jmp 0xb696
movl -0x10(%rbp), %eax
subl $0x56, %eax
je 0xb8aa
jmp 0xb6a4
movl -0x10(%rbp), %eax
subl $0x57, %eax
jne 0xb9a3
jmp 0xb6b2
movslq -0x4(%rbp), %rcx
leaq 0x900b(%rip), %rax      # 0x146c8
cmpl $0xa, (%rax,%rcx,4)
jge 0xb7a9
movslq -0x4(%rbp), %rcx
leaq 0x8ffe(%rip), %rax      # 0x146d0
movl (%rax,%rcx,4), %edx
addl -0xc(%rbp), %edx
movslq -0x4(%rbp), %rcx
leaq 0x8fed(%rip), %rax      # 0x146d0
movl %edx, (%rax,%rcx,4)
movl $0x0, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x8fd8(%rip), %rax      # 0x146d0
movl (%rax,%rcx,4), %eax
movslq -0x4(%rbp), %rdx
leaq 0x8fc2(%rip), %rcx      # 0x146c8
movl (%rcx,%rdx,4), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x8fda(%rip), %rcx      # 0x146f0
cmpl (%rcx,%rdx,4), %eax
jl 0xb7a7
movslq -0x4(%rbp), %rcx
leaq 0x8fa6(%rip), %rax      # 0x146d0
movl (%rax,%rcx,4), %eax
movslq -0x4(%rbp), %rdx
leaq 0x8f90(%rip), %rcx      # 0x146c8
movl (%rcx,%rdx,4), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x8fa8(%rip), %rcx      # 0x146f0
subl (%rcx,%rdx,4), %eax
movl %eax, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x8f6f(%rip), %rax      # 0x146c8
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movslq -0x4(%rbp), %rcx
leaq 0x8f5e(%rip), %rax      # 0x146c8
movl %edx, (%rax,%rcx,4)
cmpl $0x0, -0x4(%rbp)
jne 0xb784
callq 0x32b0
leaq 0x7611(%rip), %rax      # 0x12d90
movb (%rax), %al
movb %al, -0x5(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x8f41(%rip), %rax      # 0x146d0
movl $0x0, (%rax,%rcx,4)
movl -0x4(%rbp), %edi
movb -0x5(%rbp), %al
movl -0xc(%rbp), %edx
movsbl %al, %esi
callq 0xb670
jmp 0xb7a9
jmp 0xb9b5
movslq -0x4(%rbp), %rcx
leaq 0x8f07(%rip), %rax      # 0x146c0
cmpl $0xf, (%rax,%rcx,4)
jge 0xb8a5
movslq -0x4(%rbp), %rcx
leaq 0x8f0a(%rip), %rax      # 0x146d8
movl (%rax,%rcx,4), %edx
addl -0xc(%rbp), %edx
movslq -0x4(%rbp), %rcx
leaq 0x8ef9(%rip), %rax      # 0x146d8
movl %edx, (%rax,%rcx,4)
movl $0x0, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x8ee4(%rip), %rax      # 0x146d8
movl (%rax,%rcx,4), %eax
movslq -0x4(%rbp), %rdx
leaq 0x8ebe(%rip), %rcx      # 0x146c0
movl (%rcx,%rdx,4), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x8f0e(%rip), %rcx      # 0x14720
cmpl (%rcx,%rdx,4), %eax
jl 0xb8a3
movslq -0x4(%rbp), %rcx
leaq 0x8eb2(%rip), %rax      # 0x146d8
movl (%rax,%rcx,4), %eax
movslq -0x4(%rbp), %rdx
leaq 0x8e8c(%rip), %rcx      # 0x146c0
movl (%rcx,%rdx,4), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x8edc(%rip), %rcx      # 0x14720
subl (%rcx,%rdx,4), %eax
movl %eax, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x8e6b(%rip), %rax      # 0x146c0
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movslq -0x4(%rbp), %rcx
leaq 0x8e5a(%rip), %rax      # 0x146c0
movl %edx, (%rax,%rcx,4)
cmpl $0x0, -0x4(%rbp)
jne 0xb880
callq 0x32b0
leaq 0x7515(%rip), %rax      # 0x12d90
movb (%rax), %al
movb %al, -0x5(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x8e4d(%rip), %rax      # 0x146d8
movl $0x0, (%rax,%rcx,4)
movl -0x4(%rbp), %edi
movb -0x5(%rbp), %al
movl -0xc(%rbp), %edx
movsbl %al, %esi
callq 0xb670
jmp 0xb8a5
jmp 0xb9b5
movslq -0x4(%rbp), %rcx
leaq 0x8e03(%rip), %rax      # 0x146b8
cmpl $0xc, (%rax,%rcx,4)
jge 0xb9a1
movslq -0x4(%rbp), %rcx
leaq 0x8e16(%rip), %rax      # 0x146e0
movl (%rax,%rcx,4), %edx
addl -0xc(%rbp), %edx
movslq -0x4(%rbp), %rcx
leaq 0x8e05(%rip), %rax      # 0x146e0
movl %edx, (%rax,%rcx,4)
movl $0x0, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x8df0(%rip), %rax      # 0x146e0
movl (%rax,%rcx,4), %eax
movslq -0x4(%rbp), %rdx
leaq 0x8dba(%rip), %rcx      # 0x146b8
movl (%rcx,%rdx,4), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x8e52(%rip), %rcx      # 0x14760
cmpl (%rcx,%rdx,4), %eax
jl 0xb99f
movslq -0x4(%rbp), %rcx
leaq 0x8dbe(%rip), %rax      # 0x146e0
movl (%rax,%rcx,4), %eax
movslq -0x4(%rbp), %rdx
leaq 0x8d88(%rip), %rcx      # 0x146b8
movl (%rcx,%rdx,4), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x8e20(%rip), %rcx      # 0x14760
subl (%rcx,%rdx,4), %eax
movl %eax, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x8d67(%rip), %rax      # 0x146b8
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movslq -0x4(%rbp), %rcx
leaq 0x8d56(%rip), %rax      # 0x146b8
movl %edx, (%rax,%rcx,4)
cmpl $0x0, -0x4(%rbp)
jne 0xb97c
callq 0x32b0
leaq 0x7419(%rip), %rax      # 0x12d90
movb (%rax), %al
movb %al, -0x5(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x8d59(%rip), %rax      # 0x146e0
movl $0x0, (%rax,%rcx,4)
movl -0x4(%rbp), %edi
movb -0x5(%rbp), %al
movl -0xc(%rbp), %edx
movsbl %al, %esi
callq 0xb670
jmp 0xb9a1
jmp 0xb9b5
movsbl -0x5(%rbp), %esi
leaq 0x36ff(%rip), %rdi      # 0xf0ad
movb $0x0, %al
callq 0x2030
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)