// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/test/../hts_time_funcs.h
// Function: hts_time_gm
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:
movl (%rdi), %edx
xorl %eax, %eax
movl $0x0, %ecx
cmpl $0x3f, %edx
jl 0x120b
movl %edx, %ecx
movl $0x88888889, %esi       # imm = 0x88888889
imulq %rcx, %rsi
shrq $0x25, %rsi
movslq 0x4(%rdi), %r8
addq %rsi, %r8
movslq %r8d, %r9
movl $0x1, %ecx
cmpq %r8, %r9
jne 0x120b
movl %r8d, 0x4(%rdi)
imull $-0x3c, %esi, %ecx
addl %edx, %ecx
movl %ecx, (%rdi)
xorl %ecx, %ecx
movl 0x4(%rdi), %edx
cmpl $0x3c, %edx
jb 0x1260
testl %edx, %edx
js 0x1228
movl %edx, %eax
movl $0x88888889, %esi       # imm = 0x88888889
imulq %rax, %rsi
shrq $0x25, %rsi
jmp 0x123b
movl %edx, %eax
notl %eax
movl $0x88888889, %esi       # imm = 0x88888889
imulq %rax, %rsi
shrq $0x25, %rsi
notl %esi
movslq 0x8(%rdi), %rax
movslq %esi, %r8
addq %rax, %r8
movslq %r8d, %r9
movl $0x1, %eax
cmpq %r8, %r9
jne 0x1260
movl %r8d, 0x8(%rdi)
imull $-0x3c, %esi, %eax
addl %edx, %eax
movl %eax, 0x4(%rdi)
xorl %eax, %eax
orl %ecx, %eax
movl 0x8(%rdi), %edx
xorl %ecx, %ecx
movl $0x0, %r8d
cmpl $0x18, %edx
jb 0x12c7
testl %edx, %edx
js 0x1288
movl %edx, %r8d
movl $0xaaaaaaab, %esi       # imm = 0xAAAAAAAB
imulq %r8, %rsi
shrq $0x24, %rsi
jmp 0x129d
movl %edx, %r8d
notl %r8d
movl $0xaaaaaaab, %esi       # imm = 0xAAAAAAAB
imulq %r8, %rsi
shrq $0x24, %rsi
notl %esi
movslq 0xc(%rdi), %r8
movslq %esi, %r9
addq %r8, %r9
movslq %r9d, %r10
movl $0x1, %r8d
cmpq %r9, %r10
jne 0x12c7
movl %r9d, 0xc(%rdi)
shll $0x3, %esi
leal (%rsi,%rsi,2), %esi
subl %esi, %edx
movl %edx, 0x8(%rdi)
xorl %r8d, %r8d
orl %r8d, %eax
movl 0x10(%rdi), %edx
cmpl $0xc, %edx
jb 0x1322
testl %edx, %edx
js 0x12e7
movl %edx, %ecx
movl $0xaaaaaaab, %esi       # imm = 0xAAAAAAAB
imulq %rcx, %rsi
shrq $0x23, %rsi
jmp 0x12fa
movl %edx, %ecx
notl %ecx
movl $0xaaaaaaab, %esi       # imm = 0xAAAAAAAB
imulq %rcx, %rsi
shrq $0x23, %rsi
notl %esi
movslq 0x14(%rdi), %rcx
movslq %esi, %r8
addq %rcx, %r8
movslq %r8d, %r9
movl $0x1, %ecx
cmpq %r8, %r9
jne 0x1322
movl %r8d, 0x14(%rdi)
shll $0x2, %esi
leal (%rsi,%rsi,2), %ecx
subl %ecx, %edx
movl %edx, 0x10(%rdi)
xorl %ecx, %ecx
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
orl %ecx, %eax
je 0x1349
callq 0x1030
movl $0x4b, (%rax)
movq $-0x1, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movslq 0x14(%rdi), %r9
leaq 0x76c(%r9), %rcx
movl 0xc(%rdi), %ebp
movabsq $-0x5c28f5c28f5c28f5, %r10 # imm = 0xA3D70A3D70A3D70B
movabsq $-0x70a3d70a3d70a3d7, %r8 # imm = 0x8F5C28F5C28F5C29
movabsq $0x51eb851eb851eb0, %r11 # imm = 0x51EB851EB851EB0
movabsq $0xa3d70a3d70a3d7, %rbx # imm = 0xA3D70A3D70A3D7
testl %ebp, %ebp
jg 0x13f0
xorl %r14d, %r14d
cmpl $0x2, 0x10(%rdi)
setge %r14b
leaq 0xdab(%rip), %r15       # 0x2140
leaq (%r14,%rcx), %rsi
decq %rsi
movq %rsi, %rax
imulq %r10
testb $0x3, %sil
jne 0x13d1
leaq (%r14,%rcx), %rax
addq %rdx, %rax
decq %rax
movq %rax, %rdx
shrq $0x3f, %rdx
sarq $0x6, %rax
addq %rdx, %rax
imulq $0x64, %rax, %rdx
movq %rsi, %r12
movl $0x1, %eax
subq %rdx, %r12
jne 0x13e4
imulq %r8, %rsi
addq %r11, %rsi
rorq $0x4, %rsi
xorl %eax, %eax
cmpq %rbx, %rsi
setb %al
decq %rcx
addl (%r15,%rax,4), %ebp
jle 0x1395
movl %ebp, 0xc(%rdi)
movl 0xc(%rdi), %ebp
cmpl $0x16f, %ebp            # imm = 0x16F
jl 0x1464
xorl %r14d, %r14d
cmpl $0x2, 0x10(%rdi)
setge %r14b
leaq 0xd33(%rip), %r15       # 0x2140
leaq (%r14,%rcx), %rsi
movq %rsi, %rax
imulq %r10
testb $0x3, %sil
jne 0x143f
addq %rsi, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x6, %rdx
addq %rax, %rdx
imulq $0x64, %rdx, %rdx
movq %rsi, %r12
movl $0x1, %eax
subq %rdx, %r12
jne 0x1452
imulq %r8, %rsi
addq %r11, %rsi
rorq $0x4, %rsi
xorl %eax, %eax
cmpq %rbx, %rsi
setb %al
subl (%r15,%rax,4), %ebp
incq %rcx
cmpl $0x16e, %ebp            # imm = 0x16E
jg 0x140d
movl %ebp, 0xc(%rdi)
movl 0xc(%rdi), %esi
movl 0x10(%rdi), %r15d
leaq 0xc6e(%rip), %r14       # 0x20e0
xorl %ebp, %ebp
movq %rcx, %rax
imulq %r10
testb $0x3, %cl
jne 0x14a1
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x6, %rdx
addq %rax, %rdx
imulq $0x64, %rdx, %rdx
movq %rcx, %r12
movl $0x1, %eax
subq %rdx, %r12
jne 0x14b7
movq %rcx, %rdx
imulq %r8, %rdx
addq %r11, %rdx
rorq $0x4, %rdx
xorl %eax, %eax
cmpq %rbx, %rdx
setb %al
movslq %r15d, %rdx
leaq (%rax,%rax,2), %rax
shll $0x4, %eax
addq %r14, %rax
movl (%rax,%rdx,4), %eax
movl %esi, %edx
subl %eax, %edx
jle 0x14ec
movl %edx, 0xc(%rdi)
xorl %r12d, %r12d
cmpl $0xb, %r15d
leal 0x1(%r15), %r15d
cmovgel %ebp, %r15d
setge %r12b
addq %r12, %rcx
movl %r15d, 0x10(%rdi)
jmp 0x14ee
movl %esi, %edx
cmpl %eax, %esi
movl %edx, %esi
jg 0x1474
leaq -0x76c(%rcx), %rax
cmpq %r9, %rax
je 0x1520
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addq %rdx, %rcx
addq $0x7ffff894, %rcx       # imm = 0x7FFFF894
cmpq %rdx, %rcx
jb 0x132e
movl %eax, 0x14(%rdi)
movl 0x14(%rdi), %r10d
cmpl $0x46, %r10d
jl 0x132e
leaq 0x76c(%r10), %rcx
leal 0x76b(%r10), %eax
imulq $0x51eb851f, %rax, %rdx # imm = 0x51EB851F
shrl $0x2, %eax
movq %rdx, %rsi
shrq $0x25, %rsi
shrq $0x27, %rdx
subl %esi, %eax
addl %edx, %eax
addl $0xfffffe23, %eax       # imm = 0xFFFFFE23
movl %r10d, %edx
subl %eax, %edx
imull $0x16d, %edx, %r9d      # imm = 0x16D
addl $0xffff9c32, %r9d       # imm = 0xFFFF9C32
imull $0x16e, %eax, %esi      # imm = 0x16E
movabsq $0x28f5c28f5c28f5d, %rdx # imm = 0x28F5C28F5C28F5D
movq %rcx, %rax
mulq %rdx
testb $0x3, %cl
jne 0x15a4
imulq $0x64, %rdx, %rax
negq %rax
leaq (%r10,%rax), %rdx
addq $0x76c, %rdx            # imm = 0x76C
movl $0x1, %eax
testq %rdx, %rdx
jne 0x15be
imulq %r8, %rcx
rorq $0x4, %rcx
movabsq $0xa3d70a3d70a3d8, %rdx # imm = 0xA3D70A3D70A3D8
xorl %eax, %eax
cmpq %rdx, %rcx
setb %al
movslq 0x10(%rdi), %rcx
leaq (%rax,%rax,2), %rax
shll $0x4, %eax
leaq 0xab0(%rip), %rdx       # 0x2080
addq %rax, %rdx
addl %r9d, %esi
addl (%rdx,%rcx,4), %esi
movl 0xc(%rdi), %eax
addl %esi, %eax
decl %eax
cltq
imulq $0x15180, %rax, %rcx    # imm = 0x15180
movslq 0x8(%rdi), %rax
imulq $0xe10, %rax, %rax      # imm = 0xE10
movslq 0x4(%rdi), %rdx
imulq $0x3c, %rdx, %rdx
addq %rax, %rdx
movslq (%rdi), %rax
addq %rdx, %rax
addq %rcx, %rax
jmp 0x1340