// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_bitstream_from_segments
void xlink_bitstream_from_segments(xlink_bitstream *bs, xlink_ec_segment *code,
 xlink_ec_segment *data, int capacity, int fast, int clamp) {
  xlink_encoder enc;
  xlink_decoder dec;
  xlink_context ctx;
  int i;
  xlink_bitstream_init(bs);
  /* Create a context from code models */
  xlink_context_init(&ctx, &code->models, capacity, fast, clamp);
  /* Create an encoder from the context */
  xlink_encoder_init(&enc, &ctx);
  /* Encode the code bytes */
  xlink_encoder_write_bytes(&enc, &code->bytes);
  /* If the data segment has any bytes */
  if (xlink_list_length(&data->bytes) > 0) {
    /* Reset the context with the data models */
    ctx.models = &data->models;
    xlink_set_reset(&ctx.matches);
    /* Encode the code bytes */
    xlink_encoder_write_bytes(&enc, &data->bytes);
  }
  /* Finalize the bitstream */
  xlink_encoder_finalize(&enc, bs);
  xlink_encoder_clear(&enc);
  xlink_context_clear(&ctx);
  /* Create a context from code models */
  xlink_context_init(&ctx, &code->models, capacity, fast, clamp);
  /* Initialize the decoder with the context and bitstream */
  xlink_decoder_init(&dec, &ctx, bs);
  /* Test that decoded code bytes match original input */
  xlink_decoder_test_bytes(&dec, &code->bytes);
  /* If the data segment has any bytes */
  if (xlink_list_length(&data->bytes) > 0) {
    /* Reset the context with the data models */
    ctx.models = &data->models;
    xlink_set_reset(&ctx.matches);
    /* Test that decoded data bytes match original input */
    xlink_decoder_test_bytes(&dec, &data->bytes);
  }
  xlink_decoder_clear(&dec);
  xlink_context_clear(&ctx);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl %r9d, %r13d
movl %r8d, %ebp
movl %ecx, %r15d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, 0x20(%rsp)
callq 0x7e60
leaq 0x18(%r14), %rsi
leaq 0x88(%rsp), %r12
movq %r12, %rdi
movq %rsi, 0x18(%rsp)
movl %r15d, 0xc(%rsp)
movl %r15d, %edx
movl %ebp, 0x10(%rsp)
movl %ebp, %ecx
movl %r13d, 0x14(%rsp)
movl %r13d, %r8d
callq 0x89b0
leaq 0x50(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x7ee6
movq %r13, %rdi
movq %r14, %rsi
callq 0x7ff0
movq %rbx, %rdi
callq 0x94be
testl %eax, %eax
jle 0x6664
leaq 0x18(%rbx), %rax
leaq 0x98(%rsp), %rdi
movq %rax, -0x8(%rdi)
callq 0x9919
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x7ff0
leaq 0x50(%rsp), %r12
movq %r12, %rdi
movq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0x8100
movq %r12, %rdi
callq 0x7fe7
leaq 0x88(%rsp), %r12
movq %r12, %rdi
callq 0x8a85
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x10(%rsp), %ecx
movl 0x14(%rsp), %r8d
callq 0x89b0
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8352
movq %r13, %rdi
movq %r14, %rsi
callq 0x64c8
movq %rbx, %rdi
callq 0x94be
testl %eax, %eax
jle 0x66f7
leaq 0x18(%rbx), %rax
leaq 0x98(%rsp), %rdi
movq %rax, -0x8(%rdi)
callq 0x9919
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x64c8
leaq 0x28(%rsp), %rdi
callq 0x8493
leaq 0x88(%rsp), %rdi
callq 0x8a85
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq