// File: /workspace/github_c_makefile_star2_O1/ieyasu[P]funit/build_rule.c
// Function: parse_build_rule
void *parse_build_rule(char *build)
{
    struct BRFragments *f = NEW0(struct BRFragments);
    struct StringBuffer sb;
    sb_init(&sb, 128);

    // parse one character at a time, handling special forms as they appear
    size_t i = 0;
    while (build[i] != '\0') {
        switch (build[i]) {
        case '$':
            if (build[i + 1] != '{') goto just_copy;
            i = parse_env_var(&sb, build, i);
            break;
        case '{':
            if (build[i + 1] != '{') goto just_copy;
            i = parse_internal_var(f, &sb, build, i);
            break;
        case '\\':
            switch (build[i + 1]) {
            case '$':
            case '{':
            case '}':
            case '\\':
                i++; // skip the escaping backslash
                goto just_copy;
            default:
                break; // unknown sequence - no escape - fall through
            }
            // FALL THROUGH
        default:
 just_copy:
            sb_add_char(&sb, build[i++]);
            break;
        }
    }

    if (sb.len > 0) { // one last string to add
        close_string_fragment(f, &sb);
    }

    sb_free(&sb);

    return f;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movl $0x1, %edi
movl $0x18, %esi
callq 0x2170
movq %rax, 0x8(%rsp)
leaq 0x10(%rsp), %rbx
movl $0x80, %esi
movq %rbx, %rdi
callq 0x6d49
xorl %r15d, %r15d
leaq (%r14,%r15), %rbp
movb (%r14,%r15), %al
movzbl %al, %ecx
cmpl $0x5b, %ecx
jle 0x2d84
cmpl $0x5c, %ecx
je 0x2e11
cmpl $0x7b, %ecx
jne 0x2e41
cmpb $0x7b, 0x1(%rbp)
jne 0x2e41
cmpb $0x7b, %al
jne 0x3009
leaq 0x2(%rbp), %r13
movl $0x2, %r12d
movzbl (%rbp,%r12), %eax
testl %eax, %eax
je 0x2e56
cmpl $0x7d, %eax
je 0x2e56
incq %r12
jmp 0x2d68
cmpl $0x24, %ecx
jne 0x2e39
cmpb $0x7b, 0x1(%rbp)
jne 0x2e41
cmpb $0x24, %al
jne 0x2fea
cmpb $0x7b, 0x1(%r14,%r15)
jne 0x2fea
leaq 0x2(%rbp), %r12
movq %r12, %rdi
leaq 0x4631(%rip), %rsi      # 0x73ea
callq 0x2150
cmpb $0x7d, 0x2(%rbp,%rax)
leaq 0x4627(%rip), %rdi      # 0x73f1
jne 0x2f0b
movq %rax, %r13
leaq 0x4692(%rip), %rdi      # 0x746c
testq %rax, %rax
je 0x2f0b
movb $0x0, (%r12,%r13)
movq %r12, %rdi
callq 0x2030
movb $0x7d, (%r12,%r13)
testq %rax, %rax
je 0x2e05
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6e16
addq %r13, %r15
addq $0x3, %r15
jmp 0x2d2a
movzbl 0x1(%r14,%r15), %eax
leal -0x5c(%rax), %ecx
cmpl $0x21, %ecx
ja 0x2e2f
movabsq $0x280000001, %rdx      # imm = 0x280000001
btq %rcx, %rdx
jb 0x2e34
cmpl $0x24, %eax
jne 0x2e41
incq %r15
jmp 0x2e41
testl %ecx, %ecx
je 0x2fb4
movsbl (%r14,%r15), %esi
incq %r15
movq %rbx, %rdi
callq 0x6db7
jmp 0x2d2a
cmpq $0x2, %r12
je 0x2f38
cmpb $0x7d, %al
jne 0x2f1e
cmpb $0x7d, 0x1(%rbp,%r12)
jne 0x2f1e
movb $0x0, (%rbp,%r12)
xorl %ebx, %ebx
leaq 0x8ecd(%rip), %rax      # 0xbd50
movq (%rbx,%rax), %rsi
movq %r13, %rdi
callq 0x2180
testl %eax, %eax
je 0x2ea4
addq $0x10, %rbx
cmpq $0x90, %rbx
jne 0x2e7c
xorl %ebx, %ebx
jmp 0x2eae
leaq 0x8ea5(%rip), %rax      # 0xbd50
addq %rax, %rbx
testq %rbx, %rbx
je 0x2f63
movb $0x7d, (%rbp,%r12)
movq 0x8(%rsp), %r13
movq %r13, %rdi
leaq 0x10(%rsp), %rbp
movq %rbp, %rsi
callq 0x3028
movq %r13, %rdi
callq 0x34fa
movq (%r13), %rax
movq 0x8(%r13), %rcx
movq %rcx, %rdx
shlq $0x4, %rdx
movl $0x1, (%rax,%rdx)
movq 0x8(%rbx), %rsi
movq %rbp, %rbx
movq %rsi, 0x8(%rax,%rdx)
incq %rcx
movq %rcx, 0x8(%r13)
addq %r12, %r15
jmp 0x2fab
incq %r15
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x239e
jmp 0x2d2a
movq 0x90d3(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x46a9(%rip), %rsi      # 0x75d8
leaq 0x466e(%rip), %rdx      # 0x75a4
jmp 0x2f50
movq 0x90b9(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x468f(%rip), %rsi      # 0x75d8
leaq 0x462c(%rip), %rdx      # 0x757c
movq %rbp, %rcx
leaq 0x9206(%rip), %r8       # 0xc160
xorl %eax, %eax
callq 0x2190
jmp 0x2f97
movq 0x908e(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x4664(%rip), %rsi      # 0x75d8
leaq 0x4648(%rip), %rdx      # 0x75c3
movq %r13, %rcx
leaq 0x91db(%rip), %r8       # 0xc160
xorl %eax, %eax
callq 0x2190
movb $0x7d, (%rbp,%r12)
leaq 0x10(%rsp), %rbx
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x462f(%rip), %rsi      # 0x75d5
callq 0x6de4
addq $0x2, %r15
jmp 0x2d2a
cmpq $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rbx
je 0x2fce
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x3028
leaq 0x10(%rsp), %rdi
callq 0x6d72
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4383(%rip), %rdi      # 0x7374
leaq 0x43a3(%rip), %rsi      # 0x739b
leaq 0x43a9(%rip), %rcx      # 0x73a8
movl $0x13a, %edx            # imm = 0x13A
callq 0x2120
leaq 0x44ee(%rip), %rdi      # 0x74fe
leaq 0x4384(%rip), %rsi      # 0x739b
leaq 0x4507(%rip), %rcx      # 0x7525
movl $0x107, %edx            # imm = 0x107
callq 0x2120