// File: /workspace/github_c_makefile_star2_O0/masyagin1998[P]GCI/src/parser/parser.c
// Function: object_literal_ast_read
static enum PARSER_CODES object_literal_ast_read(struct PARSER*parser, struct OBJECT_LITERAL_AST**object_literal)
{
    enum PARSER_CODES r;
    struct PROPERTY_AST**properties = NULL;
    size_t properties_len = 0;
    size_t properties_cap = 0;
    
    if ((parser->tok)->token_type != TOKEN_TYPE_LBRACE) {
        r = PARSER_INVALID_TOKEN;
        set_parser_error(parser, 1, TOKEN_TYPE_LBRACE);
        goto err0;
    }    
    token_free((parser->tok));
    lexer_next_token(parser->lexer, &(parser->tok));

    while ((parser->tok)->token_type != TOKEN_TYPE_RBRACE) {
        struct PROPERTY_AST*property;
        r = property_ast_read(parser, &property);
        if (r != PARSER_OK) {
            goto err1;
        }
        PUSH_BACK(properties, property);

        if ((parser->tok)->token_type == TOKEN_TYPE_RBRACE) {
            break;
        }

        if ((parser->tok)->token_type != TOKEN_TYPE_COMMA) {
            r = PARSER_INVALID_TOKEN;
            set_parser_error(parser, 1, TOKEN_TYPE_COMMA);
            goto err1;
        }
        token_free((parser->tok));
        lexer_next_token(parser->lexer, &(parser->tok));
    }
    
    token_free((parser->tok));
    lexer_next_token(parser->lexer, &(parser->tok));

    (*object_literal) = create_object_literal_ast(properties, properties_len,
                                                  (parser->tok)->frag.starting.line,
                                                  (parser->tok)->frag.starting.pos);

    return PARSER_OK;

 err1:
    if (properties != NULL) {
        size_t i;
        for (i = 0; i < properties_len; i++) {
            property_ast_free(properties[i]);
        }
        SAFE_FREE(properties);
    }
 err0:
    (*object_literal) = NULL;
    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x20, (%rax)
je 0x81d6
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
movl $0x1, %esi
movl $0x20, %edx
movb $0x0, %al
callq 0x4030
jmp 0x8419
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x31b0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
callq 0x1fd0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x21, (%rax)
je 0x8371
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x8580
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x8223
jmp 0x83ca
jmp 0x8225
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x82f5
cmpq $0x0, -0x38(%rbp)
jne 0x8293
movq $0x1, -0x38(%rbp)
movq -0x38(%rbp), %rdi
shlq $0x3, %rdi
callq 0x1130
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x828f
movq 0x16d90(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x38(%rbp), %r8
shlq $0x3, %r8
leaq 0x1039c(%rip), %rsi     # 0x1860e
leaq 0x105ef(%rip), %rdx     # 0x18868
movl $0x3d2, %ecx            # imm = 0x3D2
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x8291
jmp 0x82f3
movq -0x38(%rbp), %rax
shlq %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
shlq $0x3, %rsi
callq 0x1150
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x82ef
movq 0x16d30(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x38(%rbp), %r8
shlq $0x3, %r8
leaq 0x106c3(%rip), %rsi     # 0x18995
leaq 0x1058f(%rip), %rdx     # 0x18868
movl $0x3d2, %ecx            # imm = 0x3D2
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x82f1
jmp 0x82f3
jmp 0x82f5
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x21, (%rax)
jne 0x8320
jmp 0x8371
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x22, (%rax)
je 0x834b
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
movl $0x1, %esi
movl $0x22, %edx
movb $0x0, %al
callq 0x4030
jmp 0x83ca
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x31b0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
callq 0x1fd0
jmp 0x81f7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x31b0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
callq 0x1fd0
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rcx
callq 0xb120
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x842a
cmpq $0x0, -0x28(%rbp)
je 0x8417
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x8402
movq -0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xb2e0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x83d9
jmp 0x8404
movq -0x28(%rbp), %rdi
callq 0x1030
movq $0x0, -0x28(%rbp)
jmp 0x8417
jmp 0x8419
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)