// File: /workspace/github_c_makefile_star2_O0/orangeduck[P]mpc/mpc.c
// Function: mpc_copy
mpc_parser_t *mpc_copy(mpc_parser_t *a) {
  int i = 0;
  mpc_parser_t *p;

  if (a->retained) { return a; }

  p = mpc_undefined();
  p->retained = a->retained;
  p->type = a->type;
  p->data = a->data;

  if (a->name) {
    p->name = malloc(strlen(a->name)+1);
    strcpy(p->name, a->name);
  }

  switch (a->type) {

    case MPC_TYPE_FAIL:
      p->data.fail.m = malloc(strlen(a->data.fail.m)+1);
      strcpy(p->data.fail.m, a->data.fail.m);
    break;

    case MPC_TYPE_ONEOF:
    case MPC_TYPE_NONEOF:
    case MPC_TYPE_STRING:
      p->data.string.x = malloc(strlen(a->data.string.x)+1);
      strcpy(p->data.string.x, a->data.string.x);
      break;

    case MPC_TYPE_APPLY:    p->data.apply.x    = mpc_copy(a->data.apply.x);    break;
    case MPC_TYPE_APPLY_TO: p->data.apply_to.x = mpc_copy(a->data.apply_to.x); break;
    case MPC_TYPE_PREDICT:  p->data.predict.x  = mpc_copy(a->data.predict.x);  break;

    case MPC_TYPE_MAYBE:
    case MPC_TYPE_NOT:
      p->data.not.x = mpc_copy(a->data.not.x);
      break;

    case MPC_TYPE_EXPECT:
      p->data.expect.x = mpc_copy(a->data.expect.x);
      p->data.expect.m = malloc(strlen(a->data.expect.m)+1);
      strcpy(p->data.expect.m, a->data.expect.m);
      break;

    case MPC_TYPE_MANY:
    case MPC_TYPE_MANY1:
    case MPC_TYPE_COUNT:
      p->data.repeat.x = mpc_copy(a->data.repeat.x);
      break;

    case MPC_TYPE_SEPBY1:
      p->data.sepby1.x   = mpc_copy(a->data.sepby1.x);
      p->data.sepby1.sep = mpc_copy(a->data.sepby1.sep);
      break;

    case MPC_TYPE_OR:
      p->data.or.xs = malloc(a->data.or.n * sizeof(mpc_parser_t*));
      for (i = 0; i < a->data.or.n; i++) {
        p->data.or.xs[i] = mpc_copy(a->data.or.xs[i]);
      }
    break;
    case MPC_TYPE_AND:
      p->data.and.xs = malloc(a->data.and.n * sizeof(mpc_parser_t*));
      for (i = 0; i < a->data.and.n; i++) {
        p->data.and.xs[i] = mpc_copy(a->data.and.xs[i]);
      }
      p->data.and.dxs = malloc((a->data.and.n-1) * sizeof(mpc_dtor_t));
      for (i = 0; i < a->data.and.n-1; i++) {
        p->data.and.dxs[i] = a->data.and.dxs[i];
      }
    break;

    case MPC_TYPE_CHECK:
      p->data.check.x      = mpc_copy(a->data.check.x);
      p->data.check.e      = malloc(strlen(a->data.check.e)+1);
      strcpy(p->data.check.e, a->data.check.e);
      break;
    case MPC_TYPE_CHECK_WITH:
      p->data.check_with.x = mpc_copy(a->data.check_with.x);
      p->data.check_with.e = malloc(strlen(a->data.check_with.e)+1);
      strcpy(p->data.check_with.e, a->data.check_with.e);
      break;

    default: break;
  }


  return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x31(%rax)
je 0x6eaa
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x72d0
callq 0x6e40
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movb 0x31(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x31(%rax)
movq -0x10(%rbp), %rax
movb 0x30(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x30(%rax)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
movl $0x28, %edx
callq 0x44e0
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x6f28
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x41b0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x4570
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x40e0
movq -0x10(%rbp), %rax
movsbl 0x30(%rax), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x1b, %eax
ja 0x72c6
movq -0x28(%rbp), %rax
leaq 0xb21f(%rip), %rcx      # 0x1216c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x41b0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x4570
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x40e0
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x41b0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x4570
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x40e0
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x41b0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x4570
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x40e0
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x72c8
movq -0x10(%rbp), %rax
movslq 0x8(%rax), %rdi
shlq $0x3, %rdi
callq 0x4570
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x7150
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4620
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7111
jmp 0x72c8
movq -0x10(%rbp), %rax
movslq 0x8(%rax), %rdi
shlq $0x3, %rdi
callq 0x4570
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x71b7
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4620
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7178
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
subl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x4570
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x721b
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x71df
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x41b0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x4570
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x40e0
jmp 0x72c8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4620
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x41b0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x4570
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x40e0
jmp 0x72c8
jmp 0x72c8
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)