// File: /workspace/github_c_makefile_star2_O3/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
testl %ebp, %ebp
jle 0xe86f
movq 0x8(%rsp), %rdi
addq $0x18, %rdi
movl %ebp, %r13d
xorl %eax, %eax
movq (%r14,%rax,8), %rcx
movl (%rcx), %edx
movq 0x8(%rsp), %rsi
cmpl (%rsi), %edx
jle 0xe6f7
movl 0x8(%rcx), %edx
movq 0x8(%rsp), %rsi
movl %edx, 0x8(%rsi)
movq (%rcx), %rcx
movq %rcx, (%rsi)
incq %rax
cmpq %rax, %r13
jne 0xe6d7
testl %ebp, %ebp
jle 0xe86f
movq %rdi, 0x28(%rsp)
movl %ebp, 0x18(%rsp)
movq 0x8(%rsp), %rax
movl (%rax), %edx
xorl %r15d, %r15d
movl $0x0, 0x4(%rsp)
xorl %esi, %esi
movq %r14, 0x10(%rsp)
movq %r13, 0x30(%rsp)
movl %edx, 0x1c(%rsp)
movq (%r14,%rsi,8), %r14
cmpl %edx, (%r14)
jl 0xe819
movq 0x18(%r14), %r12
testq %r12, %r12
jne 0xe82c
movb 0x28(%r14), %al
movq 0x8(%rsp), %rcx
movb %al, 0x28(%rcx)
cmpl $0x0, 0xc(%r14)
jle 0xe819
movq %rsi, 0x20(%rsp)
xorl %ebx, %ebx
movq 0x20(%r14), %rax
movq (%rax,%rbx,8), %r12
cmpl $0x0, 0x4(%rsp)
jle 0xe798
movl 0x4(%rsp), %r13d
xorl %ebp, %ebp
movq (%r15,%rbp,8), %rdi
movq %r12, %rsi
callq 0x2210
testl %eax, %eax
je 0xe7ef
incq %rbp
cmpq %rbp, %r13
jne 0xe780
movl 0x4(%rsp), %eax
movslq %eax, %r14
incl %eax
movl %eax, 0x4(%rsp)
leaq 0x8(,%r14,8), %rsi
movq %r15, %rdi
callq 0x22e0
movq %rax, %r15
movq 0x8(%rsp), %rax
movq %r15, 0x20(%rax)
movq %r12, %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0x2290
movq %rax, (%r15,%r14,8)
movq %rax, %rdi
movq %r12, %rsi
callq 0x2080
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %r14
incq %rbx
movslq 0xc(%r14), %rax
cmpq %rax, %rbx
jl 0xe76a
movq 0x8(%rsp), %rax
movl 0x4(%rsp), %ecx
movl %ecx, 0xc(%rax)
movq 0x30(%rsp), %r13
movl 0x1c(%rsp), %edx
movq 0x20(%rsp), %rsi
incq %rsi
cmpq %r13, %rsi
movq 0x10(%rsp), %r14
jne 0xe732
jmp 0xe855
movq %r12, %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0x2290
movq 0x28(%rsp), %rcx
movq %rax, (%rcx)
movq %rax, %rdi
movq %r12, %rsi
callq 0x2080
movq 0x10(%rsp), %r14
cmpl $0x0, 0x18(%rsp)
jle 0xe86f
xorl %ebx, %ebx
movq (%r14,%rbx,8), %rdi
callq 0x79f4
incq %rbx
cmpq %rbx, %r13
jne 0xe85e
movq 0x8(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq