// File: /workspace/github_c_makefile_star2_O0/wjmelements[P]evm/evm.c
// Function: assemble
static void assemble(const char *contents) {
    op_t *programStart = &ops[CONSTRUCTOR_OFFSET];
    uint32_t programLength = 0;
    scanInit();
    for (; scanValid(&contents); programLength++) {
        if (programLength > (PROGRAM_BUFFER_LENGTH - CONSTRUCTOR_OFFSET)) {
            fprintf(stderr, "Program size exceeds limit; terminating");
            break;
        }
        programStart[programLength] = scanNextOp(&contents);
    }
    scanFinalize(programStart, &programLength);
    if (labelJumpdests) {
        fprintLabels(stdout);
        return;
    }
    if (wrapConstructor) {
        if (programLength < 0x20) {
            // PUSHx<>3d5260xx60xxf3
            programStart -= 1;
            *programStart = (PUSH1 - 1) + programLength;
            *((uint32_t *)(programStart + programLength + 1)) = 0x0060523d + (programLength << 24);
            *((uint32_t *)(programStart + programLength + 5)) = 0xf30060 + ((32 - programLength) << 8);
            programLength += 8;
        } else if (programLength == 0x20) {
            // 7f<>3d5260203df3
            programStart -= 1;
            *programStart = PUSH32;
            *((uint32_t *)(programStart + programLength + 1)) = 0x2060523d;
            *((uint16_t *)(programStart + programLength + 5)) = 0xf33d;
            programLength += 7;
        } else {
            programStart -= 4;
            *((uint32_t *)programStart) = 0xf33d393d;
            if (programLength < 0x100) {
                // 60xx8060093d393df3<>
                programStart -= 3;
                *((uint32_t *)programStart) = 0x3d096080;
                programStart -= 2;
                *((uint16_t *)programStart) = 0x0060 | programLength << 8;
                programLength += 9;
            } else if (programLength < 0x10000) {
                // 61xxxx80600a3d393df3<>
                programStart -= 3;
                *((uint32_t *)programStart) = 0x3d0a6080;
                programStart -= 3;
                *((uint32_t *)programStart) = 0x80000061 | (programLength & 0xff) << 16 | (programLength & 0xff00);
                programLength += 10;
            }
        }
    }

    for (; programLength--;) printf("%02x", *programStart++);
    putchar('\n');
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x1cdbd(%rip), %rax     # 0x20a20
addq $0x1000, %rax           # imm = 0x1000
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movb $0x0, %al
callq 0x16cc0
leaq -0x8(%rbp), %rdi
callq 0x16cf0
cmpl $0x0, %eax
je 0x3ccc
cmpl $0x7000, -0x14(%rbp)    # imm = 0x7000
jbe 0x3cac
movq 0x1c35f(%rip), %rax     # 0x1fff8
movq (%rax), %rdi
leaq 0x165ca(%rip), %rsi     # 0x1a26d
movb $0x0, %al
callq 0x31e0
jmp 0x3ccc
leaq -0x8(%rbp), %rdi
callq 0x173e0
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3c7b
movq -0x10(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x17a80
cmpl $0x0, 0x1cd20(%rip)     # 0x20a00
je 0x3cf6
movq 0x1c2df(%rip), %rax     # 0x1ffc8
movq (%rax), %rdi
callq 0x17f90
jmp 0x3ea3
cmpl $0x0, 0x1ccfb(%rip)     # 0x209f8
je 0x3e65
cmpl $0x20, -0x14(%rbp)
jae 0x3d64
movq -0x10(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x5f, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movl -0x14(%rbp), %edx
shll $0x18, %edx
addl $0x60523d, %edx         # imm = 0x60523D
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %edx, 0x1(%rax,%rcx)
movl $0x20, %edx
subl -0x14(%rbp), %edx
shll $0x8, %edx
addl $0xf30060, %edx         # imm = 0xF30060
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %edx, 0x5(%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x14(%rbp)
jmp 0x3e63
cmpl $0x20, -0x14(%rbp)
jne 0x3da8
movq -0x10(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movb $0x7f, (%rax)
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movl $0x2060523d, 0x1(%rax,%rcx) # imm = 0x2060523D
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movw $0xf33d, 0x5(%rax,%rcx) # imm = 0xF33D
movl -0x14(%rbp), %eax
addl $0x7, %eax
movl %eax, -0x14(%rbp)
jmp 0x3e61
movq -0x10(%rbp), %rax
addq $-0x4, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0xf33d393d, (%rax)     # imm = 0xF33D393D
cmpl $0x100, -0x14(%rbp)     # imm = 0x100
jae 0x3e07
movq -0x10(%rbp), %rax
addq $-0x3, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x3d096080, (%rax)     # imm = 0x3D096080
movq -0x10(%rbp), %rax
addq $-0x2, %rax
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
shll $0x8, %eax
orl $0x60, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, (%rax)
movl -0x14(%rbp), %eax
addl $0x9, %eax
movl %eax, -0x14(%rbp)
jmp 0x3e5f
cmpl $0x10000, -0x14(%rbp)   # imm = 0x10000
jae 0x3e5d
movq -0x10(%rbp), %rax
addq $-0x3, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x3d0a6080, (%rax)     # imm = 0x3D0A6080
movq -0x10(%rbp), %rax
addq $-0x3, %rax
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %ecx
andl $0xff, %ecx
shll $0x10, %ecx
orl $0x80000061, %ecx       # imm = 0x80000061
movl -0x14(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
orl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
addl $0xa, %eax
movl %eax, -0x14(%rbp)
jmp 0x3e5f
jmp 0x3e61
jmp 0x3e63
jmp 0x3e65
jmp 0x3e67
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x14(%rbp)
cmpl $0x0, %eax
je 0x3e99
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movzbl (%rax), %esi
leaq 0x1657e(%rip), %rdi     # 0x1a40e
movb $0x0, %al
callq 0x3100
jmp 0x3e67
movl $0xa, %edi
callq 0x3050
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)