// File: /workspace/github_c_makefile_star2_O1/voithos[P]awl/src/mpc.c
// Function: mpc_err_or
static mpc_err_t *mpc_err_or(mpc_err_t** x, int n) {
  
  int i, j;
  mpc_err_t *e = malloc(sizeof(mpc_err_t));
  e->state = mpc_state_invalid();
  e->expected_num = 0;
  e->expected = NULL;
  e->failure = NULL;
  e->filename = malloc(strlen(x[0]->filename)+1);
  strcpy(e->filename, x[0]->filename);
  
  for (i = 0; i < n; i++) {
    if (x[i]->state.pos > e->state.pos) { e->state = x[i]->state; }
  }
  
  for (i = 0; i < n; i++) {
    
    if (x[i]->state.pos < e->state.pos) { continue; }
    
    if (x[i]->failure) {
      e->failure = malloc(strlen(x[i]->failure)+1);
      strcpy(e->failure, x[i]->failure);
      break;
    }
    
    e->recieved = x[i]->recieved;
    
    for (j = 0; j < x[i]->expected_num; j++) {
      if (!mpc_err_contains_expected(e, x[i]->expected[j])) { mpc_err_add_expected(e, x[i]->expected[j]); }
    }
  }
  
  for (i = 0; i < n; i++) {
    mpc_err_delete(x[i]);
  }
  
  return e;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %ebp
movq %rdi, %r14
movl $0x30, %edi
callq 0x2290
movq %rax, %rbx
movq $-0x1, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movq (%r14), %rax
movq 0x10(%rax), %r15
movq %r15, %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0x2290
movq %rbx, 0x8(%rsp)
movq %rax, 0x10(%rbx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x2080
movl %ebp, %r12d
movl %ebp, 0x10(%rsp)
testl %ebp, %ebp
jle 0xeb71
xorl %eax, %eax
movq (%r14,%rax,8), %rcx
movl (%rcx), %edx
movq 0x8(%rsp), %rsi
cmpl (%rsi), %edx
jle 0xeb69
movl 0x8(%rcx), %edx
movq 0x8(%rsp), %rsi
movl %edx, 0x8(%rsi)
movq (%rcx), %rcx
movq %rcx, (%rsi)
incq %rax
cmpq %rax, %r12
jne 0xeb49
cmpl $0x0, 0x10(%rsp)
jle 0xecb9
movq 0x8(%rsp), %rax
movq %rax, %rcx
addq $0x18, %rcx
movq %rcx, 0x20(%rsp)
movl (%rax), %edx
xorl %esi, %esi
movq %r14, 0x30(%rsp)
movq %r12, 0x28(%rsp)
movl %edx, 0x14(%rsp)
movq (%r14,%rsi,8), %rax
cmpl %edx, (%rax)
jl 0xec87
movq 0x18(%rax), %r15
testq %r15, %r15
jne 0xec95
movb 0x28(%rax), %al
movq 0x8(%rsp), %rcx
movb %al, 0x28(%rcx)
movq (%r14,%rsi,8), %rax
cmpl $0x0, 0xc(%rax)
jle 0xec87
movq 0x8(%rsp), %rcx
movl 0xc(%rcx), %r13d
xorl %ebx, %ebx
movq %rsi, 0x18(%rsp)
movq 0x20(%rax), %rax
movq (%rax,%rbx,8), %r15
testl %r13d, %r13d
jle 0xec14
movq 0x8(%rsp), %rax
movq 0x20(%rax), %r12
movl %r13d, %r14d
xorl %ebp, %ebp
movq (%r12,%rbp,8), %rdi
movq %r15, %rsi
callq 0x2210
testl %eax, %eax
je 0xec57
incq %rbp
cmpq %rbp, %r14
jne 0xebfc
movq 0x8(%rsp), %rbp
movq 0x20(%rbp), %rdi
movslq %r13d, %r14
incl %r13d
leaq 0x8(,%r14,8), %rsi
callq 0x22e0
movq %rax, %r12
movq %rax, 0x20(%rbp)
movq %r15, %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0x2290
movq %rax, (%r12,%r14,8)
movq %rax, %rdi
movq %r15, %rsi
callq 0x2080
movq 0x18(%rsp), %rsi
incq %rbx
movq 0x30(%rsp), %r14
movq (%r14,%rsi,8), %rax
movslq 0xc(%rax), %rcx
cmpq %rcx, %rbx
jl 0xebe1
movq 0x8(%rsp), %rax
movl %r13d, 0xc(%rax)
movq 0x28(%rsp), %r12
movl 0x14(%rsp), %edx
incq %rsi
cmpq %r12, %rsi
jne 0xeb9f
jmp 0xecb9
movq %r15, %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0x2290
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x2080
cmpl $0x0, 0x10(%rsp)
jle 0xecd3
xorl %ebx, %ebx
movq (%r14,%rbx,8), %rdi
callq 0x7d64
incq %rbx
cmpq %rbx, %r12
jne 0xecc2
movq 0x8(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq