// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: reduce_fraction
static int32_t reduce_fraction(s7_int *numer, s7_int *denom)
    {
        /* we're assuming in several places that we have a normal s7 rational after returning,
         *    so the denominator needs to be positive.
         */
        s7_int divisor;

        if (*numer == 0)
        {
            *denom = 1;
            return(T_INTEGER);
        }
        if (*denom < 0)
        {
            if (*denom == *numer)
            {
                *denom = 1;
                *numer = 1;
                return(T_INTEGER);
            }
            if (*denom == s7_int_min)
            {
                if (*numer & 1)
                    return(T_RATIO);
                *denom /= 2;
                *numer /= 2;
            }
            else
            {
                if (*numer == s7_int_min)
                {
                    if (*denom & 1)
                        return(T_RATIO);
                    *denom /= 2;
                    *numer /= 2;
                }
            }
            *denom = -*denom;
            *numer = -*numer;
        }
        divisor = c_gcd(*numer, *denom);
        if (divisor != 1)
        {
            *numer /= divisor;
            *denom /= divisor;
        }
        if (*denom == 1)
            return(T_INTEGER);
        return(T_RATIO);
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x48(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x1bc742
movq 0x40(%rsp), %rax
movq $0x1, (%rax)
movl $0xb, 0x54(%rsp)
jmp 0x1bc91b
movq 0x40(%rsp), %rax
cmpq $0x0, (%rax)
jge 0x1bc898
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq 0x48(%rsp), %rcx
cmpq (%rcx), %rax
jne 0x1bc788
movq 0x40(%rsp), %rax
movq $0x1, (%rax)
movq 0x48(%rsp), %rax
movq $0x1, (%rax)
movl $0xb, 0x54(%rsp)
jmp 0x1bc91b
movq 0x40(%rsp), %rax
movq (%rax), %rax
cmpq 0x5ddc1(%rip), %rax     # 0x21a558
jne 0x1bc7fe
movq 0x48(%rsp), %rax
movq (%rax), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x1bc7b8
movl $0xc, 0x54(%rsp)
jmp 0x1bc91b
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rax
movq %rax, 0x30(%rsp)
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
jmp 0x1bc874
movq 0x48(%rsp), %rax
movq (%rax), %rax
cmpq 0x5dd4b(%rip), %rax     # 0x21a558
jne 0x1bc872
movq 0x40(%rsp), %rax
movq (%rax), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x1bc82e
movl $0xc, 0x54(%rsp)
jmp 0x1bc91b
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rax
movq %rax, 0x20(%rsp)
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
jmp 0x1bc874
movq 0x40(%rsp), %rax
xorl %ecx, %ecx
subq (%rax), %rcx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rax
xorl %ecx, %ecx
subq (%rax), %rcx
movq 0x48(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rax
movq (%rax), %rdi
movq 0x40(%rsp), %rax
movq (%rax), %rsi
callq 0x1bc3f0
movq %rax, 0x38(%rsp)
cmpq $0x1, 0x38(%rsp)
je 0x1bc8fe
movq 0x38(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
movq (%rax), %rax
cqto
idivq %rcx
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq (%rax), %rax
cqto
idivq %rcx
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rax
cmpq $0x1, (%rax)
jne 0x1bc913
movl $0xb, 0x54(%rsp)
jmp 0x1bc91b
movl $0xc, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)