// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http.c
// Function: serve_headers
static int serve_headers(http_request_t* rq, http_headers_out_t* out, char* mime_type, off_t length, unsigned errstatus) {
    char headers[MAXMSG] = { '\0' };
    char buf[MAXLINE] = { '\0' };
    struct tm tm;
    time_t now;
    size_t size;

    if (out == NULL) {
        sprintf(headers, "%s %u %s\r\n", PROTOCOL, errstatus, get_shortmsg(errstatus));

        sprintf(headers, "%sServer: %s\r\n", headers, SERVER_NAME);

        now = time((time_t *)0);
        strftime(buf, MAXLINE, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&now));
        sprintf(headers, "%sDate: %s\r\n", headers, buf);

        sprintf(headers, "%sConnection: close\r\n", headers);

        if (mime_type) {
            sprintf(headers, "%sContent-type: %s\r\n", headers, mime_type);
        }

        if (length >= 0) {
            sprintf(headers, "%sContent-length: %lld\r\n", headers, (long long)length);
        }

        sprintf(headers, "%s\r\n", headers);
    } else {
        sprintf(headers, "%s %u %s\r\n", PROTOCOL, out->status, get_shortmsg(out->status));

        sprintf(headers, "%sServer: %s\r\n", headers, SERVER_NAME);

        now = time((time_t *)0);
        strftime(buf, MAXLINE, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&now));
        sprintf(headers, "%sDate: %s\r\n", headers, buf);

        if (out->keep_alive) {
            sprintf(headers, "%sConnection: keep-alive\r\n", headers);
            sprintf(headers, "%sKeep-Alive: timeout=%lu\r\n", headers, rq->timeout);
        }

        if (mime_type) {
            sprintf(headers, "%sContent-type: %s\r\n", headers, mime_type);
        }

        if (length >= 0) {
            sprintf(headers, "%sContent-length: %lld\r\n", headers, (long long)length);
        }

        if (out->if_modified) {
            localtime_r(&(out->mtime), &tm);
            strftime(buf, MAXLINE, "%a, %d %b %Y %H:%M:%S GMT", &tm);
            sprintf(headers, "%sLast-Modified: %s\r\n", headers, buf);
        }

        sprintf(headers, "%s\r\n", headers);
    }

    size = rio_writen(rq->fd, headers, strlen(headers));

    if (size < 0) {
        log_error("send headers error.");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x12c0, %rsp           # imm = 0x12C0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
leaq -0x1030(%rbp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x21d0
leaq -0x1230(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x21d0
cmpq $0x0, -0x18(%rbp)
jne 0x487a
leaq -0x1030(%rbp), %rax
movq %rax, -0x1290(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x1284(%rbp)
movl -0x2c(%rbp), %edi
callq 0x4ba0
movq -0x1290(%rbp), %rdi
movl -0x1284(%rbp), %ecx
movq %rax, %r8
leaq 0x4f9d(%rip), %rsi      # 0x96f3
leaq 0x4fa1(%rip), %rdx      # 0x96fe
movb $0x0, %al
callq 0x2410
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4f8e(%rip), %rsi      # 0x9707
leaq 0x4f96(%rip), %rcx      # 0x9716
movb $0x0, %al
callq 0x2410
xorl %eax, %eax
movl %eax, %edi
callq 0x22b0
movq %rax, -0x1270(%rbp)
leaq -0x1230(%rbp), %rax
movq %rax, -0x1280(%rbp)
leaq -0x1270(%rbp), %rdi
callq 0x23d0
movq -0x1280(%rbp), %rdi
movq %rax, %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x4f5b(%rip), %rdx      # 0x9722
callq 0x2390
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq -0x1230(%rbp), %rcx
leaq 0x4f54(%rip), %rsi      # 0x973c
movb $0x0, %al
callq 0x2410
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4f45(%rip), %rsi      # 0x9749
movb $0x0, %al
callq 0x2410
cmpq $0x0, -0x20(%rbp)
je 0x4832
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x4f34(%rip), %rsi      # 0x975f
movb $0x0, %al
callq 0x2410
cmpq $0x0, -0x28(%rbp)
jl 0x4859
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x4f22(%rip), %rsi      # 0x9774
movb $0x0, %al
callq 0x2410
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4f67(%rip), %rsi      # 0x97d5
movb $0x0, %al
callq 0x2410
jmp 0x4a77
leaq -0x1030(%rbp), %rax
movq %rax, -0x12a8(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x8, %eax
movl %eax, -0x129c(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %edi
shrl $0x8, %edi
callq 0x4ba0
movq -0x12a8(%rbp), %rdi
movl -0x129c(%rbp), %ecx
movq %rax, %r8
leaq 0x4e37(%rip), %rsi      # 0x96f3
leaq 0x4e3b(%rip), %rdx      # 0x96fe
movb $0x0, %al
callq 0x2410
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4e28(%rip), %rsi      # 0x9707
leaq 0x4e30(%rip), %rcx      # 0x9716
movb $0x0, %al
callq 0x2410
xorl %eax, %eax
movl %eax, %edi
callq 0x22b0
movq %rax, -0x1270(%rbp)
leaq -0x1230(%rbp), %rax
movq %rax, -0x1298(%rbp)
leaq -0x1270(%rbp), %rdi
callq 0x23d0
movq -0x1298(%rbp), %rdi
movq %rax, %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x4df5(%rip), %rdx      # 0x9722
callq 0x2390
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq -0x1230(%rbp), %rcx
leaq 0x4dee(%rip), %rsi      # 0x973c
movb $0x0, %al
callq 0x2410
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x49a6
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4e15(%rip), %rsi      # 0x978d
movb $0x0, %al
callq 0x2410
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x20e8(%rax), %rcx
leaq 0x4e09(%rip), %rsi      # 0x97a8
movb $0x0, %al
callq 0x2410
cmpq $0x0, -0x20(%rbp)
je 0x49cd
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x4d99(%rip), %rsi      # 0x975f
movb $0x0, %al
callq 0x2410
cmpq $0x0, -0x28(%rbp)
jl 0x49f4
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x4d87(%rip), %rsi      # 0x9774
movb $0x0, %al
callq 0x2410
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x4a5b
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
leaq -0x1268(%rbp), %rsi
callq 0x2080
leaq -0x1230(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
leaq 0x4cf6(%rip), %rdx      # 0x9722
leaq -0x1268(%rbp), %rcx
callq 0x2390
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq -0x1230(%rbp), %rcx
leaq 0x4d70(%rip), %rsi      # 0x97c4
movb $0x0, %al
callq 0x2410
leaq -0x1030(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4d65(%rip), %rsi      # 0x97d5
movb $0x0, %al
callq 0x2410
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x12b4(%rbp)
leaq -0x1030(%rbp), %rax
movq %rax, -0x12b0(%rbp)
leaq -0x1030(%rbp), %rdi
callq 0x2130
movl -0x12b4(%rbp), %edi
movq -0x12b0(%rbp), %rsi
movq %rax, %rdx
callq 0x7660
movq %rax, -0x1278(%rbp)
cmpq $0x0, -0x1278(%rbp)
jae 0x4af2
movl $0x4, %edi
leaq 0x4ac5(%rip), %rsi      # 0x9594
leaq 0x4d04(%rip), %rdx      # 0x97da
movl $0x1a4, %ecx            # imm = 0x1A4
leaq 0x4d06(%rip), %r8       # 0x97e8
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4af9
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x12c0, %rsp           # imm = 0x12C0
popq %rbp
retq
nopw %cs:(%rax,%rax)