// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/boot/buffer_test.c
// Function: buffer_test
int buffer_test() {

    int i;
    JanetBuffer *buffer1, *buffer2;

    buffer1 = janet_buffer(100);
    buffer2 = janet_buffer(0);

    janet_buffer_push_cstring(buffer1, "hello, world!\n");

    janet_buffer_push_u8(buffer2, 'h');
    janet_buffer_push_u8(buffer2, 'e');
    janet_buffer_push_u8(buffer2, 'l');
    janet_buffer_push_u8(buffer2, 'l');
    janet_buffer_push_u8(buffer2, 'o');
    janet_buffer_push_u8(buffer2, ',');
    janet_buffer_push_u8(buffer2, ' ');
    janet_buffer_push_u8(buffer2, 'w');
    janet_buffer_push_u8(buffer2, 'o');
    janet_buffer_push_u8(buffer2, 'r');
    janet_buffer_push_u8(buffer2, 'l');
    janet_buffer_push_u8(buffer2, 'd');
    janet_buffer_push_u8(buffer2, '!');
    janet_buffer_push_u8(buffer2, '\n');

    assert(buffer1->count == buffer2->count);
    assert(buffer1->capacity >= buffer1->count);
    assert(buffer2->capacity >= buffer2->count);

    for (i = 0; i < buffer1->count; i++) {
        assert(buffer1->data[i] == buffer2->data[i]);
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x64, %edi
callq 0x18490
movq %rax, -0x10(%rbp)
xorl %edi, %edi
callq 0x18490
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x1d1fb(%rip), %rsi     # 0x99477
callq 0x18750
movq -0x18(%rbp), %rdi
movl $0x68, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x65, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x6c, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x6c, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x6f, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x2c, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x20, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x77, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x6f, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x72, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x6c, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x64, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0x21, %esi
callq 0x18820
movq -0x18(%rbp), %rdi
movl $0xa, %esi
callq 0x18820
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x7c357
jmp 0x7c376
leaq 0x1d128(%rip), %rdi     # 0x99486
leaq 0x1d142(%rip), %rsi     # 0x994a7
movl $0x35, %edx
leaq 0x1d14d(%rip), %rcx     # 0x994be
callq 0x123f0
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jl 0x7c388
jmp 0x7c3a7
leaq 0x1d141(%rip), %rdi     # 0x994d0
leaq 0x1d111(%rip), %rsi     # 0x994a7
movl $0x36, %edx
leaq 0x1d11c(%rip), %rcx     # 0x994be
callq 0x123f0
movq -0x18(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jl 0x7c3b9
jmp 0x7c3d8
leaq 0x1d134(%rip), %rdi     # 0x994f4
leaq 0x1d0e0(%rip), %rsi     # 0x994a7
movl $0x37, %edx
leaq 0x1d0eb(%rip), %rcx     # 0x994be
callq 0x123f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x7c43d
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x4(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x4(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x7c411
jmp 0x7c430
leaq 0x1d100(%rip), %rdi     # 0x99518
leaq 0x1d088(%rip), %rsi     # 0x994a7
movl $0x3a, %edx
leaq 0x1d093(%rip), %rcx     # 0x994be
callq 0x123f0
jmp 0x7c432
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x7c3df
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop