// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x30, %edi
callq 0x2250
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
callq 0x134d0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movl %edx, -0x38(%rbp)
movq %rcx, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq %rcx, -0x2c(%rbp)
movl -0x38(%rbp), %ecx
movl %ecx, -0x24(%rbp)
movq -0x2c(%rbp), %rcx
movq %rcx, (%rax)
movl -0x24(%rbp), %ecx
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
callq 0x20f0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x2250
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rsi
callq 0x2070
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x13ca3
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jle 0x13c96
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movl 0x8(%rcx), %ecx
movl %ecx, 0x8(%rax)
jmp 0x13c98
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x13c5c
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x13dc7
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x13cd1
jmp 0x13db9
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x18(%rax)
je 0x13d32
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rdi
callq 0x20f0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x2250
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rsi
callq 0x2070
jmp 0x13dc7
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movb 0x28(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x28(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpl 0xc(%rcx), %eax
jge 0x13db7
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x13e00
cmpl $0x0, %eax
jne 0x13daa
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x13e70
jmp 0x13dac
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x13d4f
jmp 0x13db9
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x13caa
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x13df2
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xa380
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x13dce
movq -0x20(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)