// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonsndfile/src/readwrite.c
// Function: Write
static int Write(lua_State *L)
    {
    ud_t *ud;
    size_t size;
    sf_count_t frames, nframes = 0;
    sndfile_t sndfile = checksndfile(L, 1, &ud);
    int t = checktype(L, 2);
    const char *ptr = luaL_checklstring(L, 3, &size);
    switch(t)
        {
        case NONSF_TYPE_SHORT:  frames = CheckSize_short(L, 3, ud, size);
                                nframes = sf.writef_short(sndfile, (short*)ptr, frames);
                                break;
        case NONSF_TYPE_INT:    frames = CheckSize_int(L, 3, ud, size);
                                nframes = sf.writef_int(sndfile, (int*)ptr, frames);
                                break;
        case NONSF_TYPE_FLOAT:  frames = CheckSize_float(L, 3, ud, size);
                                nframes = sf.writef_float(sndfile, (float*)ptr, frames);
                                break;
        case NONSF_TYPE_DOUBLE: frames = CheckSize_double(L, 3, ud, size);
                                nframes = sf.writef_double(sndfile, (double*)ptr, frames);
                                break;
        default:
            return luaL_argerror(L, 2, "invalid type");
        }
    lua_pushinteger(L, nframes);
    lua_pushinteger(L, frames);
    return 2;
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x48(%rsp), %rdi
leaq 0x4bd9(%rip), %rcx      # 0x12097
movl $0x1, %esi
leaq 0x40(%rsp), %rdx
callq 0x4400
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rdi
movl $0x65, %esi
movl $0x2, %edx
callq 0x4120
movl %eax, 0x1c(%rsp)
movq 0x48(%rsp), %rdi
movl $0x3, %esi
leaq 0x38(%rsp), %rdx
callq 0x4380
movq %rax, 0x10(%rsp)
movl 0x1c(%rsp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, 0x8(%rsp)
subl $0x3, %eax
ja 0xd644
movq 0x8(%rsp), %rax
leaq 0x5e3f(%rip), %rcx      # 0x13364
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
movl $0x3, %esi
callq 0xd970
movq %rax, 0x30(%rsp)
movq 0x9a8d(%rip), %rax      # 0x16fe0
movq 0x90(%rax), %rax
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq *%rax
movq %rax, 0x28(%rsp)
jmp 0xd660
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
movl $0x3, %esi
callq 0xd9f0
movq %rax, 0x30(%rsp)
movq 0x9a46(%rip), %rax      # 0x16fe0
movq 0xa0(%rax), %rax
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq *%rax
movq %rax, 0x28(%rsp)
jmp 0xd660
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
movl $0x3, %esi
callq 0xda70
movq %rax, 0x30(%rsp)
movq 0x99ff(%rip), %rax      # 0x16fe0
movq 0xb0(%rax), %rax
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq *%rax
movq %rax, 0x28(%rsp)
jmp 0xd660
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
movl $0x3, %esi
callq 0xdaf0
movq %rax, 0x30(%rsp)
movq 0x99bb(%rip), %rax      # 0x16fe0
movq 0xc0(%rax), %rax
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq *%rax
movq %rax, 0x28(%rsp)
jmp 0xd660
movq 0x48(%rsp), %rdi
movl $0x2, %esi
leaq 0x5e71(%rip), %rdx      # 0x134c6
callq 0x4100
movl %eax, 0x54(%rsp)
jmp 0xd686
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x4320
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x4320
movl $0x2, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nop