// File: zgimbutas[P]mwrap/src/mwrap-typecheck.cc
// Function: fortranize_args(Var*, int)
int fortranize_args(Var* v, int line)
{
    if (!v)
        return 0;
    int errcount = 0;
    if (v->tinfo == VT_obj || v->tinfo == VT_p_obj || v->tinfo == VT_r_obj) {
        fprintf(stderr, "Error (%d): ", line);
        fprintf(stderr, "Cannot pass object %s to FORTRAN\n", v->name);
        ++errcount;
    } else if (v->tinfo == VT_rarray) {
        fprintf(stderr, "Error (%d): ", line);
        fprintf(stderr, "Cannot pass pointer ref %s to FORTRAN\n", v->name);
        ++errcount;
    } else if (v->tinfo == VT_string) {
        fprintf(stderr, "Warning (%d): ", line);
        fprintf(stderr, "Danger passing C string %s to FORTRAN\n", v->name);
    } else if (v->tinfo == VT_scalar || v->tinfo == VT_r_scalar) {
        v->tinfo = VT_p_scalar;
    } else if (v->tinfo == VT_cscalar || v->tinfo == VT_r_cscalar) {
        v->tinfo = VT_p_cscalar;
    } else if (v->tinfo == VT_zscalar || v->tinfo == VT_r_zscalar) {
        v->tinfo = VT_p_zscalar;
    }
    return errcount + fortranize_args(v->next, line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xb7a2
movl $0x0, -0x4(%rbp)
jmp 0xb935
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, 0x20(%rax)
je 0xb7c7
movq -0x10(%rbp), %rax
cmpl $0xb, 0x20(%rax)
je 0xb7c7
movq -0x10(%rbp), %rax
cmpl $0xf, 0x20(%rax)
jne 0xb810
movq 0x1980a(%rip), %rax     # 0x24fd8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
leaq 0x93e8(%rip), %rsi      # 0x14bc3
movb $0x0, %al
callq 0x33a0
movq 0x197ef(%rip), %rax     # 0x24fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0x93d5(%rip), %rsi      # 0x14bd0
movb $0x0, %al
callq 0x33a0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xb915
movq -0x10(%rbp), %rax
cmpl $0x5, 0x20(%rax)
jne 0xb863
movq 0x197b7(%rip), %rax     # 0x24fd8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
leaq 0x9395(%rip), %rsi      # 0x14bc3
movb $0x0, %al
callq 0x33a0
movq 0x1979c(%rip), %rax     # 0x24fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0x93a4(%rip), %rsi      # 0x14bf2
movb $0x0, %al
callq 0x33a0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xb913
movq -0x10(%rbp), %rax
cmpl $0x9, 0x20(%rax)
jne 0xb8aa
movq 0x19764(%rip), %rax     # 0x24fd8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
leaq 0x9398(%rip), %rsi      # 0x14c19
movb $0x0, %al
callq 0x33a0
movq 0x19749(%rip), %rax     # 0x24fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0x9387(%rip), %rsi      # 0x14c28
movb $0x0, %al
callq 0x33a0
jmp 0xb911
movq -0x10(%rbp), %rax
cmpl $0x6, 0x20(%rax)
je 0xb8be
movq -0x10(%rbp), %rax
cmpl $0x10, 0x20(%rax)
jne 0xb8cb
movq -0x10(%rbp), %rax
movl $0xc, 0x20(%rax)
jmp 0xb90f
movq -0x10(%rbp), %rax
cmpl $0x7, 0x20(%rax)
je 0xb8df
movq -0x10(%rbp), %rax
cmpl $0x11, 0x20(%rax)
jne 0xb8ec
movq -0x10(%rbp), %rax
movl $0xd, 0x20(%rax)
jmp 0xb90d
movq -0x10(%rbp), %rax
cmpl $0x8, 0x20(%rax)
je 0xb900
movq -0x10(%rbp), %rax
cmpl $0x12, 0x20(%rax)
jne 0xb90b
movq -0x10(%rbp), %rax
movl $0xe, 0x20(%rax)
jmp 0xb90d
jmp 0xb90f
jmp 0xb911
jmp 0xb913
jmp 0xb915
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movl -0x14(%rbp), %esi
callq 0xb780
movl %eax, %ecx
movl -0x1c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop