user: What is the c source code of the assembly code below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x160,%rsp
  mov    %edi,-0x154(%rbp)
  mov    %rsi,-0x160(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x138(%rbp)
  mov    $0x400,%edx
  mov    $0x10,%esi
  lea    D109(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1234,%edi
  mov    $0x0,%eax
  call   <srand@plt>
  movl   $0x0,-0x144(%rbp)
  jmp    L391
L218:
  lea    -0x128(%rbp),%rax
  mov    $0x400,%edx
  mov    $0x10,%esi
  mov    %rax,%rdi
  call   <posix_memalign@plt>
  test   %eax,%eax
  je     L557
  lea    D76(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L179
L557:
  mov    -0x128(%rbp),%rdx
  mov    -0x144(%rbp),%eax
  cltq
  mov    %rdx,-0x120(%rbp,%rax,8)
  addl   $0x1,-0x144(%rbp)
L391:
  cmpl   $0x10,-0x144(%rbp)
  jle    L218
  movl   $0x0,-0x144(%rbp)
  jmp    L276
L297:
  mov    -0x144(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rax
  mov    $0x400,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  addl   $0x1,-0x144(%rbp)
L276:
  cmpl   $0x10,-0x144(%rbp)
  jle    L297
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x400,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_gen_base@plt>
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x400,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  je     L348
  addl   $0x1,-0x138(%rbp)
  mov    -0x12c(%rbp),%eax
  mov    %eax,%esi
  lea    D34(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L348:
  mov    -0x120(%rbp),%rax
  add    $0x3fe,%rax
  movb   $0x7,(%rax)
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x400,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  jne    L214
  addl   $0x1,-0x138(%rbp)
  mov    -0x12c(%rbp),%eax
  mov    %eax,%esi
  lea    D142(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L214:
  mov    -0x120(%rbp),%rax
  add    $0x3fe,%rax
  movb   $0x0,(%rax)
  movl   $0x0,-0x140(%rbp)
  jmp    L597
L593:
  movl   $0x3ff,-0x144(%rbp)
  jmp    L80
L354:
  mov    -0x140(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x144(%rbp),%eax
  cltq
  add    %rdx,%rax
  movb   $0x5,(%rax)
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x400,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  jne    L514
  addl   $0x1,-0x138(%rbp)
  mov    -0x144(%rbp),%edx
  mov    -0x140(%rbp),%eax
  mov    %eax,%esi
  lea    D67(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L179
L514:
  mov    -0x140(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x144(%rbp),%eax
  cltq
  add    %rdx,%rax
  movb   $0x0,(%rax)
  subl   $0x1,-0x144(%rbp)
L80:
  cmpl   $0x0,-0x144(%rbp)
  jns    L354
  mov    $0x2e,%edi
  call   <putchar@plt>
  addl   $0x1,-0x140(%rbp)
L597:
  cmpl   $0x10,-0x140(%rbp)
  jle    L593
  movl   $0x0,-0x144(%rbp)
  jmp    L211
L252:
  mov    -0x144(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rax
  mov    $0x400,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <rand_buffer@plt>
  addl   $0x1,-0x144(%rbp)
L211:
  cmpl   $0x10,-0x144(%rbp)
  jle    L252
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x400,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_gen_base@plt>
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x400,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  je     L561
  addl   $0x1,-0x138(%rbp)
  mov    -0x12c(%rbp),%eax
  mov    %eax,%esi
  lea    D107(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L561:
  mov    -0x120(%rbp),%rax
  movzbl 0x3fe(%rax),%eax
  mov    %al,-0x145(%rbp)
  mov    -0x120(%rbp),%rax
  add    $0x3fe,%rax
  movzbl -0x145(%rbp),%edx
  xor    $0x1,%edx
  mov    %dl,(%rax)
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x400,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  jne    L233
  addl   $0x1,-0x138(%rbp)
  lea    D75(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L233:
  mov    -0x120(%rbp),%rax
  lea    0x3fe(%rax),%rdx
  movzbl -0x145(%rbp),%eax
  mov    %al,(%rdx)
  movl   $0x0,-0x140(%rbp)
  jmp    L161
L527:
  movl   $0x3ff,-0x144(%rbp)
  jmp    L501
L524:
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x400,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  je     L521
  addl   $0x1,-0x138(%rbp)
  mov    -0x144(%rbp),%edx
  mov    -0x140(%rbp),%eax
  mov    %eax,%esi
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L179
L521:
  mov    -0x140(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x144(%rbp),%eax
  cltq
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x145(%rbp)
  mov    -0x140(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x144(%rbp),%eax
  cltq
  add    %rdx,%rax
  movzbl -0x145(%rbp),%edx
  xor    $0x1,%edx
  mov    %dl,(%rax)
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x400,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  jne    L201
  addl   $0x1,-0x138(%rbp)
  mov    -0x144(%rbp),%edx
  mov    -0x140(%rbp),%eax
  mov    %eax,%esi
  lea    D67(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L179
L201:
  mov    -0x140(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x144(%rbp),%eax
  cltq
  add    %rax,%rdx
  movzbl -0x145(%rbp),%eax
  mov    %al,(%rdx)
  subl   $0x1,-0x144(%rbp)
L501:
  cmpl   $0x0,-0x144(%rbp)
  jns    L524
  mov    $0x2e,%edi
  call   <putchar@plt>
  addl   $0x1,-0x140(%rbp)
L161:
  cmpl   $0x10,-0x140(%rbp)
  jle    L527
  movl   $0x3,-0x140(%rbp)
  jmp    L396
L8:
  movl   $0x0,-0x144(%rbp)
  jmp    L1
L477:
  mov    -0x144(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rax
  mov    $0x400,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <rand_buffer@plt>
  addl   $0x1,-0x144(%rbp)
L1:
  mov    -0x144(%rbp),%eax
  cmp    -0x140(%rbp),%eax
  jl     L477
  lea    -0x120(%rbp),%rdx
  mov    -0x140(%rbp),%eax
  mov    $0x400,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <xor_gen_base@plt>
  movl   $0x0,-0x144(%rbp)
  jmp    L334
L58:
  movl   $0x0,-0x13c(%rbp)
  jmp    L117
L595:
  lea    -0x120(%rbp),%rdx
  mov    -0x140(%rbp),%eax
  mov    $0x400,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  je     L502
  mov    -0x140(%rbp),%eax
  mov    %eax,%esi
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x138(%rbp)
  mov    $0x1,%eax
  jmp    L179
L502:
  mov    -0x144(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x13c(%rbp),%eax
  cltq
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x145(%rbp)
  mov    -0x144(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x13c(%rbp),%eax
  cltq
  add    %rdx,%rax
  movzbl -0x145(%rbp),%edx
  xor    $0x1,%edx
  mov    %dl,(%rax)
  lea    -0x120(%rbp),%rdx
  mov    -0x140(%rbp),%eax
  mov    $0x400,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  jne    L588
  mov    -0x140(%rbp),%eax
  mov    %eax,%esi
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x138(%rbp)
  mov    $0x1,%eax
  jmp    L179
L588:
  mov    -0x144(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x13c(%rbp),%eax
  cltq
  add    %rax,%rdx
  movzbl -0x145(%rbp),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x13c(%rbp)
L117:
  cmpl   $0x3ff,-0x13c(%rbp)
  jle    L595
  addl   $0x1,-0x144(%rbp)
L334:
  mov    -0x144(%rbp),%eax
  cmp    -0x140(%rbp),%eax
  jl     L58
  mov    $0x2e,%edi
  call   <putchar@plt>
  addl   $0x1,-0x140(%rbp)
L396:
  cmpl   $0x11,-0x140(%rbp)
  jle    L8
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <fflush@plt>
  movl   $0x1,-0x13c(%rbp)
  jmp    L345
L602:
  movl   $0x3,-0x140(%rbp)
  jmp    L633
L271:
  movl   $0x0,-0x144(%rbp)
  jmp    L93
L337:
  mov    -0x144(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rax
  mov    -0x13c(%rbp),%edx
  mov    %edx,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <rand_buffer@plt>
  addl   $0x1,-0x144(%rbp)
L93:
  mov    -0x144(%rbp),%eax
  cmp    -0x140(%rbp),%eax
  jl     L337
  lea    -0x120(%rbp),%rdx
  mov    -0x13c(%rbp),%ecx
  mov    -0x140(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <xor_gen_base@plt>
  movl   $0x0,-0x130(%rbp)
  jmp    L113
L428:
  movl   $0x0,-0x134(%rbp)
  jmp    L608
L99:
  lea    -0x120(%rbp),%rdx
  mov    -0x13c(%rbp),%ecx
  mov    -0x140(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  je     L30
  mov    -0x140(%rbp),%eax
  mov    %eax,%esi
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x138(%rbp)
  mov    $0x1,%eax
  jmp    L179
L30:
  mov    -0x134(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x130(%rbp),%eax
  cltq
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x145(%rbp)
  mov    -0x134(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x130(%rbp),%eax
  cltq
  add    %rdx,%rax
  movzbl -0x145(%rbp),%edx
  xor    $0x1,%edx
  mov    %dl,(%rax)
  lea    -0x120(%rbp),%rdx
  mov    -0x13c(%rbp),%ecx
  mov    -0x140(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  jne    L152
  mov    -0x12c(%rbp),%ecx
  mov    -0x13c(%rbp),%edx
  mov    -0x140(%rbp),%eax
  mov    %eax,%esi
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x138(%rbp)
  mov    $0x1,%eax
  jmp    L179
L152:
  mov    -0x134(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x130(%rbp),%eax
  cltq
  add    %rax,%rdx
  movzbl -0x145(%rbp),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x134(%rbp)
L608:
  mov    -0x134(%rbp),%eax
  cmp    -0x140(%rbp),%eax
  jl     L99
  addl   $0xa,-0x130(%rbp)
L113:
  mov    -0x130(%rbp),%eax
  cmp    -0x13c(%rbp),%eax
  jl     L428
  addl   $0x1,-0x140(%rbp)
L633:
  cmpl   $0x11,-0x140(%rbp)
  jle    L271
  mov    $0x2e,%edi
  call   <putchar@plt>
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <fflush@plt>
  addl   $0x1,-0x13c(%rbp)
L345:
  cmpl   $0x400,-0x13c(%rbp)
  jle    L602
  movl   $0x0,-0x144(%rbp)
  jmp    L74
L394:
  movl   $0x0,-0x140(%rbp)
  jmp    L257
L525:
  mov    $0x400,%eax
  sub    -0x144(%rbp),%eax
  mov    %eax,%edx
  mov    -0x140(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <rand_buffer@plt>
  mov    -0x140(%rbp),%eax
  cltq
  mov    -0x120(%rbp,%rax,8),%rdx
  mov    -0x144(%rbp),%eax
  cltq
  add    %rax,%rdx
  mov    -0x140(%rbp),%eax
  cltq
  mov    %rdx,-0x90(%rbp,%rax,8)
  addl   $0x1,-0x140(%rbp)
L257:
  cmpl   $0x10,-0x140(%rbp)
  jle    L525
  mov    $0x400,%eax
  sub    -0x144(%rbp),%eax
  lea    -0x90(%rbp),%rdx
  mov    %eax,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_gen_base@plt>
  mov    $0x400,%eax
  sub    -0x144(%rbp),%eax
  lea    -0x90(%rbp),%rdx
  mov    %eax,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  je     L304
  mov    $0x400,%eax
  sub    -0x144(%rbp),%eax
  mov    %eax,%edx
  mov    -0x144(%rbp),%eax
  mov    %eax,%esi
  lea    D66(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x138(%rbp)
  mov    $0x1,%eax
  jmp    L179
L304:
  movl   $0x0,-0x134(%rbp)
  jmp    L191
L318:
  movl   $0x0,-0x130(%rbp)
  jmp    L127
L463:
  mov    -0x134(%rbp),%eax
  cltq
  mov    -0x90(%rbp,%rax,8),%rdx
  mov    -0x130(%rbp),%eax
  cltq
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x145(%rbp)
  mov    -0x134(%rbp),%eax
  cltq
  mov    -0x90(%rbp,%rax,8),%rdx
  mov    -0x130(%rbp),%eax
  cltq
  add    %rdx,%rax
  movzbl -0x145(%rbp),%edx
  xor    $0x1,%edx
  mov    %dl,(%rax)
  mov    $0x400,%eax
  sub    -0x144(%rbp),%eax
  lea    -0x90(%rbp),%rdx
  mov    %eax,%esi
  mov    $0x11,%edi
  mov    $0x0,%eax
  call   <xor_check@plt>
  mov    %eax,-0x12c(%rbp)
  cmpl   $0x0,-0x12c(%rbp)
  jne    L414
  mov    $0x400,%eax
  sub    -0x144(%rbp),%eax
  mov    %eax,%edx
  mov    -0x12c(%rbp),%ecx
  mov    -0x144(%rbp),%eax
  mov    %eax,%esi
  lea    D77(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x138(%rbp)
  mov    $0x1,%eax
  jmp    L179
L414:
  mov    -0x134(%rbp),%eax
  cltq
  mov    -0x90(%rbp,%rax,8),%rdx
  mov    -0x130(%rbp),%eax
  cltq
  add    %rax,%rdx
  movzbl -0x145(%rbp),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x130(%rbp)
L127:
  mov    $0x400,%eax
  sub    -0x144(%rbp),%eax
  cmp    %eax,-0x130(%rbp)
  jl     L463
  addl   $0x1,-0x134(%rbp)
L191:
  cmpl   $0x10,-0x134(%rbp)
  jle    L318
  mov    $0x2e,%edi
  call   <putchar@plt>
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <fflush@plt>
  addl   $0x20,-0x144(%rbp)
L74:
  cmpl   $0x3ff,-0x144(%rbp)
  jle    L394
  cmpl   $0x0,-0x138(%rbp)
  jne    L649
  lea    D150(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L649:
  mov    -0x138(%rbp),%eax
L179:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L0
  call   <__stack_chk_fail@plt>
L0:
  leave
  ret
```

tool_calls: name: read_data
arguments: label: D109
datatype: string
name: read_data
arguments: label: D76
datatype: string
name: read_data
arguments: label: D34
datatype: string
name: read_data
arguments: label: D142
datatype: string
name: read_data
arguments: label: D67
datatype: string
name: read_data
arguments: label: D107
datatype: string
name: read_data
arguments: label: D75
datatype: string
name: read_data
arguments: label: D21
datatype: string
name: read_data
arguments: label: D30
datatype: string
name: read_data
arguments: label: D25
datatype: string
name: read_data
arguments: label: D26
datatype: string
name: read_data
arguments: label: D66
datatype: string
name: read_data
arguments: label: D77
datatype: string
name: read_data
arguments: label: D150
datatype: string

tool: D109: Test xor_check_test %d sources X %d bytes


tool: D76: alloc error: Fail

tool: D34: 
fail zero test %d


tool: D142: 
fail corrupt buffer test %d


tool: D67: 
fail corrupt buffer test j=%d, i=%d


tool: D107: fail first rand test %d


tool: D75: 
Fail corrupt buffer test, passed when should have failed

tool: D21: 
Fail rand test with un-corrupted buffer j=%d, i=%d


tool: D30: 
fail rand test %d sources


tool: D25: 
fail rand test corrupted buffer %d sources


tool: D26: 
fail rand test corrupted buffer %d sources, len=%d, ret=%d


tool: D66: fail end test - offset: %d, len: %d


tool: D77: fail end test corrupted buffer - offset: %d, len: %d, ret: %d


tool: D150: Pass

assistant: ```c
int main(int argc, char *argv[]) {
  int i, j, k, ret, fail = 0;
  void *buffs[16 + 1];
  char c;
  int serr, lerr;
  char *tmp_buf[16 + 1];
  printf("Test xor_check_test %d sources X %d bytes\n", 16, 1024);
  srand(0x1234);
  for (i = 0; i < 16 + 1; i++) {
    void *buf;
    if (posix_memalign(&buf, 16, 1024)) {
      printf("alloc error: Fail");
      return 1;
    }
    buffs[i] = buf;
  }
  for (i = 0; i < 16 + 1; i++)
    memset(buffs[i], 0, 1024);
  xor_gen_base(16 + 1, 1024, buffs);
  ret = xor_check(16 + 1, 1024, buffs);
  if (ret != 0) {
    fail++;
    printf("\nfail zero test %d\n", ret);
  }
  ((char *)(buffs[0]))[1024 - 2] = 0x7;
  ret = xor_check(16 + 1, 1024, buffs);
  if (ret == 0) {
    fail++;
    printf("\nfail corrupt buffer test %d\n", ret);
  }
  ((char *)(buffs[0]))[1024 - 2] = 0;
  for (j = 0; j < 16 + 1; j++) {
    for (i = 1024 - 1; i >= 0; i--) {
      ((char *)buffs[j])[i] = 0x5;
      ret = xor_check(16 + 1, 1024, buffs);
      if (ret == 0) {
        fail++;
        printf("\nfail corrupt buffer test j=%d, i=%d\n", j, i);
        return 1;
      }
      ((char *)buffs[j])[i] = 0;
    }
    putchar('.');
  }
  for (i = 0; i < 16 + 1; i++)
    rand_buffer(buffs[i], 1024);
  xor_gen_base(16 + 1, 1024, buffs);
  ret = xor_check(16 + 1, 1024, buffs);
  if (ret != 0) {
    fail++;
    printf("fail first rand test %d\n", ret);
  }
  c = ((char *)(buffs[0]))[1024 - 2];
  ((char *)(buffs[0]))[1024 - 2] = c ^ 0x1;
  ret = xor_check(16 + 1, 1024, buffs);
  if (ret == 0) {
    fail++;
    printf("\nFail corrupt buffer test, passed when should have failed\n");
  }
  ((char *)(buffs[0]))[1024 - 2] = c;
  for (j = 0; j < 16 + 1; j++) {
    for (i = 1024 - 1; i >= 0; i--) {
      ret = xor_check(16 + 1, 1024, buffs);
      if (ret != 0) {
        fail++;
        printf("\nFail rand test with un-corrupted buffer j=%d, i=%d\n", j, i);
        return 1;
      }
      c = ((char *)buffs[j])[i];
      ((char *)buffs[j])[i] = c ^ 1;
      ret = xor_check(16 + 1, 1024, buffs);
      if (ret == 0) {
        fail++;
        printf("\nfail corrupt buffer test j=%d, i=%d\n", j, i);
        return 1;
      }
      ((char *)buffs[j])[i] = c;
    }
    putchar('.');
  }
  for (j = 3; j <= 16 + 1; j++) {
    for (i = 0; i < j; i++)
      rand_buffer(buffs[i], 1024);
    xor_gen_base(j, 1024, buffs);
    for (i = 0; i < j; i++) {
      for (k = 0; k < 1024; k++) {
        ret = xor_check(j, 1024, buffs);
        if (ret != 0) {
          printf("\nfail rand test %d sources\n", j);
          fail++;
          return 1;
        }
        c = ((char *)buffs[i])[k];
        ((char *)buffs[i])[k] = c ^ 1;
        ret = xor_check(j, 1024, buffs);
        if (ret == 0) {
          printf("\nfail rand test corrupted buffer %d sources\n", j);
          fail++;
          return 1;
        }
        ((char *)buffs[i])[k] = c;
      }
    }
    putchar('.');
  }
  fflush(0);
  k = 1;
  while (k <= 1024) {
    for (j = 3; j <= 16 + 1; j++) {
      for (i = 0; i < j; i++)
        rand_buffer(buffs[i], k);
      xor_gen_base(j, k, buffs);
      for (lerr = 0; lerr < k; lerr += 10) {
        for (serr = 0; serr < j; serr++) {
          ret = xor_check(j, k, buffs);
          if (ret != 0) {
            printf("\nfail rand test %d sources\n", j);
            fail++;
            return 1;
          }
          c = ((char *)buffs[serr])[lerr];
          ((char *)buffs[serr])[lerr] = c ^ 1;
          ret = xor_check(j, k, buffs);
          if (ret == 0) {
            printf("\nfail rand test corrupted buffer "
                   "%d sources, len=%d, ret=%d\n",
                   j, k, ret);
            fail++;
            return 1;
          }
          ((char *)buffs[serr])[lerr] = c;
        }
      }
    }
    putchar('.');
    fflush(0);
    k += 1;
  }
  for (i = 0; i < 1024; i += 32) {
    for (j = 0; j < 16 + 1; j++) {
      rand_buffer(buffs[j], 1024 - i);
      tmp_buf[j] = (char *)buffs[j] + i;
    }
    xor_gen_base(16 + 1, 1024 - i, (void *)tmp_buf);
    ret = xor_check(16 + 1, 1024 - i, (void *)tmp_buf);
    if (ret != 0) {
      printf("fail end test - offset: %d, len: %d\n", i, 1024 - i);
      fail++;
      return 1;
    }
    for (serr = 0; serr < 16 + 1; serr++) {
      for (lerr = 0; lerr < (1024 - i); lerr++) {
        c = tmp_buf[serr][lerr];
        tmp_buf[serr][lerr] = c ^ 1;
        ret = xor_check(16 + 1, 1024 - i, (void *)tmp_buf);
        if (ret == 0) {
          printf("fail end test corrupted buffer - "
                 "offset: %d, len: %d, ret: %d\n",
                 i, 1024 - i, ret);
          fail++;
          return 1;
        }
        tmp_buf[serr][lerr] = c;
      }
    }
    putchar('.');
    fflush(0);
  }
  if (fail == 0)
    printf("Pass\n");
  return fail;
}
```