// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/../hts_time_funcs.h
// Function: hts_time_normalise_tm
static inline int hts_time_normalise_tm(struct tm *t)
{
    const int days_per_mon[2][12] = {
        { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
        { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
    };
    const int year_days[2] = { 365, 366 };
    int overflow = 0;
    int64_t year;

    if (t->tm_sec > 62) {
        overflow |= hts_time_normalise(&t->tm_min, &t->tm_sec, 60);
    }
    overflow |= hts_time_normalise(&t->tm_hour, &t->tm_min,  60);
    overflow |= hts_time_normalise(&t->tm_mday, &t->tm_hour, 24);
    overflow |= hts_time_normalise(&t->tm_year, &t->tm_mon,  12);
    if (overflow)
        return 1;

    year = (int64_t) t->tm_year + 1900LL;
    while (t->tm_mday <= 0) {
        --year;
        t->tm_mday += year_days[hts_year_is_leap(year + (1 < t->tm_mon))];
    }
    while (t->tm_mday > 366) {
        t->tm_mday -= year_days[hts_year_is_leap(year + (1 < t->tm_mon))];
        ++year;
    }
    for (;;) {
        int mdays = days_per_mon[hts_year_is_leap(year)][t->tm_mon];
        if (t->tm_mday <= mdays)
            break;
        t->tm_mday -= mdays;
        t->tm_mon++;
        if (t->tm_mon >= 12) {
            year++;
            t->tm_mon = 0;
        }
    }
    year -= 1900;
    if (year != t->tm_year) {
        if (year < INT_MIN || year > INT_MAX)
            return 1;
        t->tm_year = year;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x70(%rbp), %rdi
leaq 0x886(%rip), %rsi       # 0x20e0
movl $0x60, %edx
callq 0x1050
movq 0x8d5(%rip), %rax       # 0x2140
movq %rax, -0x78(%rbp)
movl $0x0, -0x7c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x3e, (%rax)
jle 0x189b
movq -0x10(%rbp), %rdi
addq $0x4, %rdi
movq -0x10(%rbp), %rsi
movl $0x3c, %edx
callq 0x1b90
orl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movl $0x3c, %edx
callq 0x1b90
orl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movq -0x10(%rbp), %rdi
addq $0xc, %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
movl $0x18, %edx
callq 0x1b90
orl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x14, %rdi
movq -0x10(%rbp), %rsi
addq $0x10, %rsi
movl $0xc, %edx
callq 0x1b90
orl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
je 0x190d
movl $0x1, -0x4(%rbp)
jmp 0x1aba
movq -0x10(%rbp), %rax
movslq 0x14(%rax), %rax
addq $0x76c, %rax            # imm = 0x76C
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jg 0x1975
movq -0x88(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %eax
cmpl 0x10(%rcx), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
addq %rax, %rdi
callq 0x1b30
cltq
movl -0x78(%rbp,%rax,4), %ecx
movq -0x10(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
jmp 0x1922
jmp 0x1977
movq -0x10(%rbp), %rax
cmpl $0x16e, 0xc(%rax)       # imm = 0x16E
jle 0x19cf
movq -0x88(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %eax
cmpl 0x10(%rcx), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
addq %rax, %rdi
callq 0x1b30
cltq
movl -0x78(%rbp,%rax,4), %edx
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x1977
jmp 0x19d1
movq -0x88(%rbp), %rdi
callq 0x1b30
movslq %eax, %rcx
leaq -0x70(%rbp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movslq 0x10(%rcx), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x8c(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x8c(%rbp), %eax
jg 0x1a0d
jmp 0x1a58
movl -0x8c(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
cmpl $0xc, 0x10(%rax)
jl 0x1a53
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x10(%rax)
jmp 0x19d1
movq -0x88(%rbp), %rax
subq $0x76c, %rax            # imm = 0x76C
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x14(%rcx), %rcx
cmpq %rcx, %rax
je 0x1ab3
cmpq $-0x80000000, -0x88(%rbp) # imm = 0x80000000
jl 0x1a9a
cmpq $0x7fffffff, -0x88(%rbp) # imm = 0x7FFFFFFF
jle 0x1aa3
movl $0x1, -0x4(%rbp)
jmp 0x1aba
movq -0x88(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)