#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef char uint8_t;
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ SEEK_SET;
int atoi(char *);
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ copy_matrix(char *, char *, int, int, int);
int /*<<< orphan*/ decode_chunk(char *, char *, char *, int, int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ invert_matrix(char *, char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
void decode_file(char *confFile, char *outFile, int nativeBlockNum,
                 int parityBlockNum) {
  int chunkSize = 1;
  int totalSize;
  uint8_t *dataBuf;
  uint8_t *codeBuf;
  int dataSize;
  int codeSize;
  FILE *fp_in;
  FILE *fp_out;
  int totalMatrixSize;
  int matrixSize;
  uint8_t *totalEncodingMatrix;
  uint8_t *encodingMatrix;
  if ((fp_in = fopen(".METADATA", "rb")) == NULL) {
    printf("Can not open source file!\n");
    exit(0);
  }
  fscanf(fp_in, "%d", &totalSize);
  fscanf(fp_in, "%d %d", &parityBlockNum, &nativeBlockNum);
  chunkSize = (totalSize / nativeBlockNum) + (totalSize % nativeBlockNum != 0);
  printf("chunk size: %d\n", chunkSize);
  totalMatrixSize = nativeBlockNum * (nativeBlockNum + parityBlockNum);
  totalEncodingMatrix = (uint8_t *)malloc(totalMatrixSize);
  matrixSize = nativeBlockNum * nativeBlockNum;
  encodingMatrix = (uint8_t *)malloc(matrixSize);
  int i;
  for (i = 0; i < nativeBlockNum * (nativeBlockNum + parityBlockNum); i++) {
    fscanf(fp_in, "%d", totalEncodingMatrix + i);
  }
  dataSize = nativeBlockNum * chunkSize * sizeof(uint8_t);
  codeSize = nativeBlockNum * chunkSize * sizeof(uint8_t);
  dataBuf = (uint8_t *)malloc(dataSize);
  memset(dataBuf, 0, dataSize);
  codeBuf = (uint8_t *)malloc(codeSize);
  memset(codeBuf, 0, codeSize);
  if (confFile != NULL) {
    FILE *fp_conf;
    char input_file_name[100];
    int index;
    fp_conf = fopen(confFile, "r");
    for (i = 0; i < nativeBlockNum; i++) {
      fscanf(fp_conf, "%s", input_file_name);
      index = atoi(input_file_name + 1);
      copy_matrix(totalEncodingMatrix, encodingMatrix, index, i,
                  nativeBlockNum);
      fp_in = fopen(input_file_name, "rb");
      fseek(fp_in, 0L, SEEK_SET);
      fread(codeBuf + i * chunkSize, sizeof(uint8_t), chunkSize, fp_in);
      fclose(fp_in);
    }
    fclose(fp_conf);
  } else {
    for (i = 0; i < nativeBlockNum; i++) {
      char input_file_name[100];
      int index;
      printf("Please enter the file name of fragment:\n");
      scanf("%s", input_file_name);
      index = atoi(input_file_name + 1);
      printf("#%dth fragment\n", index);
      copy_matrix(totalEncodingMatrix, encodingMatrix, index, i,
                  nativeBlockNum);
      fp_in = fopen(input_file_name, "rb");
      fseek(fp_in, 0L, SEEK_SET);
      fread(codeBuf + i * chunkSize, sizeof(uint8_t), chunkSize, fp_in);
      fclose(fp_in);
    }
  }
  struct timespec start, end;
  double totalTime;
  clock_gettime(CLOCK_REALTIME, &start);
  uint8_t *decodingMatrix;
  decodingMatrix = (uint8_t *)malloc(matrixSize);
  invert_matrix(encodingMatrix, decodingMatrix, nativeBlockNum);
  decode_chunk(dataBuf, decodingMatrix, codeBuf, nativeBlockNum, parityBlockNum,
               chunkSize);
  clock_gettime(CLOCK_REALTIME, &end);
  totalTime = (double)(end.tv_sec - start.tv_sec) * 1000 +
              (double)(end.tv_nsec - start.tv_nsec) / (double)1000000L;
  printf("Total CPU decoding time: %fms\n", totalTime);
  if (outFile == NULL) {
    char output_file_name[100];
    printf("Enter the name of the decoded file:\n");
    scanf("%s", output_file_name);
    fp_out = fopen(output_file_name, "wb");
  } else {
    fp_out = fopen(outFile, "wb");
  }
  fwrite(dataBuf, sizeof(uint8_t), totalSize, fp_out);
  fclose(fp_out);
  free(dataBuf);
  free(codeBuf);
}


x86 assembly (clang, -O0):
<decode_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
lea    0xdd9(%rip),%rdi
lea    0xddc(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1266 <decode_file+0x56>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
xor    %edi,%edi
call   1120 <exit@plt>
mov    -0x40(%rbp),%rdi
lea    0xdca(%rip),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   10a0 <fscanf@plt>
mov    -0x40(%rbp),%rdi
lea    0xdb1(%rip),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x14(%rbp),%rcx
mov    $0x0,%al
call   10a0 <fscanf@plt>
mov    -0x20(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x1f4(%rbp)
mov    -0x20(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    -0x1f4(%rbp),%eax
cmp    $0x0,%edx
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x14(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%edx
add    -0x18(%rbp),%edx
imul   %edx,%ecx
cmp    %ecx,%eax
jge    134c <decode_file+0x13c>
mov    -0x40(%rbp),%rdi
mov    -0x58(%rbp),%rdx
movslq -0x64(%rbp),%rax
add    %rax,%rdx
lea    0xd04(%rip),%rsi
mov    $0x0,%al
call   10a0 <fscanf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    130a <decode_file+0xfa>
mov    -0x14(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x0,%rax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x0,%rax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%edx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0x38(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%edx
xor    %esi,%esi
call   1090 <memset@plt>
cmpq   $0x0,-0x8(%rbp)
je     148e <decode_file+0x27e>
mov    -0x8(%rbp),%rdi
lea    0xc98(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1480 <decode_file+0x270>
mov    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rdx
lea    0xc6c(%rip),%rsi
mov    $0x0,%al
call   10a0 <fscanf@plt>
lea    -0xe0(%rbp),%rdi
add    $0x1,%rdi
call   1110 <atoi@plt>
mov    %eax,-0xe4(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0xe4(%rbp),%edx
mov    -0x64(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   10f0 <copy_matrix@plt>
lea    -0xe0(%rbp),%rdi
lea    0xbf1(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x2ba3(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10d0 <fseek@plt>
mov    -0x30(%rbp),%rdi
mov    -0x64(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x1c(%rbp),%edx
mov    -0x40(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    -0x40(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    13c6 <decode_file+0x1b6>
mov    -0x70(%rbp),%rdi
call   1060 <fclose@plt>
jmp    1570 <decode_file+0x360>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    156b <decode_file+0x35b>
lea    0xbab(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x150(%rbp),%rsi
lea    0xb93(%rip),%rdi
call   10e0 <scanf@plt>
lea    -0x150(%rbp),%rdi
add    $0x1,%rdi
call   1110 <atoi@plt>
mov    %eax,-0x154(%rbp)
mov    -0x154(%rbp),%esi
lea    0xb97(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x154(%rbp),%edx
mov    -0x64(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   10f0 <copy_matrix@plt>
lea    -0x150(%rbp),%rdi
lea    0xb06(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x2ab8(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10d0 <fseek@plt>
mov    -0x30(%rbp),%rdi
mov    -0x64(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x1c(%rbp),%edx
mov    -0x40(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    -0x40(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1495 <decode_file+0x285>
jmp    1570 <decode_file+0x360>
mov    0x2a61(%rip),%rax
mov    (%rax),%edi
lea    -0x168(%rbp),%rsi
call   1050 <clock_gettime@plt>
mov    -0x50(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x188(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x188(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   10b0 <invert_matrix@plt>
mov    -0x28(%rbp),%rdi
mov    -0x188(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
call   1070 <decode_chunk@plt>
mov    0x2a0b(%rip),%rax
mov    (%rax),%edi
lea    -0x178(%rbp),%rsi
call   1050 <clock_gettime@plt>
mov    -0x170(%rbp),%rax
sub    -0x160(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    -0x178(%rbp),%rax
sub    -0x168(%rbp),%rax
cvtsi2sd %rax,%xmm1
movsd  0x9ff(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0x9eb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x180(%rbp)
ff
movsd  -0x180(%rbp),%xmm0
ff
lea    0xa58(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1683 <decode_file+0x473>
lea    0xa5e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x1f0(%rbp),%rsi
lea    0x9ee(%rip),%rdi
call   10e0 <scanf@plt>
lea    -0x1f0(%rbp),%rdi
lea    0xa5b(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x48(%rbp)
jmp    1697 <decode_file+0x487>
mov    -0x10(%rbp),%rdi
lea    0xa42(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%edx
mov    -0x48(%rbp),%rcx
mov    $0x1,%esi
call   1130 <fwrite@plt>
mov    -0x48(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,0x38(%rsp)
mov    %rdi,0x18(%rsp)
mov    %edx,(%rsp)
mov    %ecx,0x8(%rsp)
lea    0xdc7(%rip),%rdi
lea    0xdca(%rip),%rsi
call   1110 <fopen@plt>
test   %rax,%rax
je     1637 <decode_file+0x417>
mov    %rax,%r12
lea    0xdb8(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   10b0 <fscanf@plt>
lea    0xd9f(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10b0 <fscanf@plt>
mov    0xc(%rsp),%eax
cltd
idivl  (%rsp)
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
lea    0xd7e(%rip),%rdi
mov    %eax,%r15d
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    (%rsp),%eax
mov    0x8(%rsp),%edi
add    %eax,%edi
imul   %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,%r14
mov    (%rsp),%edi
imul   %edi,%edi
mov    %edi,0x2c(%rsp)
call   10d0 <malloc@plt>
mov    %rax,0x20(%rsp)
mov    (%rsp),%ebp
mov    0x8(%rsp),%eax
add    %ebp,%eax
imul   %ebp,%eax
test   %eax,%eax
jle    1328 <decode_file+0x108>
lea    0xd30(%rip),%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r14,%rbx,1),%rdx
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10b0 <fscanf@plt>
add    $0x1,%rbx
mov    (%rsp),%ebp
mov    0x8(%rsp),%eax
add    %ebp,%eax
imul   %ebp,%eax
cltq
cmp    %rax,%rbx
jl     1300 <decode_file+0xe0>
imul   %r15d,%ebp
mov    %ebp,%edi
call   10d0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   10a0 <memset@plt>
mov    %ebp,%edi
call   10d0 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   10a0 <memset@plt>
mov    0x18(%rsp),%rdi
test   %rdi,%rdi
mov    %rbx,0x30(%rsp)
mov    %r15d,0x4(%rsp)
je     1448 <decode_file+0x228>
lea    0xcba(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbx
cmpl   $0x0,(%rsp)
jle    143b <decode_file+0x21b>
movslq 0x4(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0x60(%rsp),%r15
mov    0x10(%rsp),%r13
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
lea    0xc7b(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10b0 <fscanf@plt>
lea    0x61(%rsp),%rdi
call   1120 <atoi@plt>
mov    (%rsp),%r8d
mov    %r14,%rdi
mov    0x20(%rsp),%rsi
mov    %eax,%edx
mov    %r12d,%ecx
call   1100 <copy_matrix@plt>
mov    %r15,%rdi
lea    0xc2c(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbp
mov    0x2be3(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10e0 <fseek@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    0x4(%rsp),%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
mov    %rbp,%rdi
call   1070 <fclose@plt>
add    $0x1,%r12
movslq (%rsp),%rax
add    0x18(%rsp),%r13
cmp    %rax,%r12
jl     13b0 <decode_file+0x190>
mov    %rbx,%rdi
call   1070 <fclose@plt>
jmp    1512 <decode_file+0x2f2>
cmpl   $0x0,(%rsp)
jle    1512 <decode_file+0x2f2>
movslq 0x4(%rsp),%r12
lea    0x60(%rsp),%r15
mov    0x10(%rsp),%rbx
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xc17(%rip),%rdi
call   1040 <puts@plt>
lea    0xbb2(%rip),%rdi
mov    %r15,%rsi
call   10f0 <scanf@plt>
lea    0x61(%rsp),%rdi
call   1120 <atoi@plt>
mov    %eax,%ebp
lea    0xb9a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    (%rsp),%r8d
mov    %r14,%rdi
mov    0x20(%rsp),%rsi
mov    %ebp,%edx
mov    %r13d,%ecx
call   1100 <copy_matrix@plt>
mov    %r15,%rdi
lea    0xb53(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbp
mov    0x2b0a(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10e0 <fseek@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    0x4(%rsp),%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
mov    %rbp,%rdi
call   1070 <fclose@plt>
add    $0x1,%r13
movslq (%rsp),%rax
add    %r12,%rbx
cmp    %rax,%r13
jl     1470 <decode_file+0x250>
mov    0x2abf(%rip),%r14
mov    (%r14),%edi
lea    0x50(%rsp),%rsi
call   1060 <clock_gettime@plt>
mov    0x2c(%rsp),%edi
call   10d0 <malloc@plt>
mov    %rax,%rbx
mov    (%rsp),%edx
mov    0x20(%rsp),%rdi
mov    %rax,%rsi
call   10c0 <invert_matrix@plt>
mov    (%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    0x10(%rsp),%r15
mov    %r15,%rdx
mov    0x4(%rsp),%r9d
call   1080 <decode_chunk@plt>
mov    (%r14),%edi
lea    0x40(%rsp),%rsi
call   1060 <clock_gettime@plt>
mov    0x40(%rsp),%rax
mov    0x48(%rsp),%rcx
sub    0x58(%rsp),%rcx
cvtsi2sd %rcx,%xmm0
sub    0x50(%rsp),%rax
cvtsi2sd %rax,%xmm1
divsd  0xa66(%rip),%xmm1
mulsd  0xa66(%rip),%xmm0
addsd  %xmm1,%xmm0
lea    0xa9b(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
mov    0x38(%rsp),%rdi
test   %rdi,%rdi
je     15c7 <decode_file+0x3a7>
lea    0xaa2(%rip),%rsi
jmp    15f1 <decode_file+0x3d1>
lea    0xa9c(%rip),%rdi
call   1040 <puts@plt>
lea    0xa5b(%rip),%rdi
lea    0x60(%rsp),%rbx
mov    %rbx,%rsi
call   10f0 <scanf@plt>
lea    0xa79(%rip),%rsi
mov    %rbx,%rdi
call   1110 <fopen@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%edx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %rax,%rcx
call   1140 <fwrite@plt>
mov    %rbx,%rdi
call   1070 <fclose@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa78(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@.str = [10 x i8] c".METADATA\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [27 x i8] c"Can not open source file!\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [16 x i8] c"chunk size: %d\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [3 x i8] c"%s\00"
@SEEK_SET = global i32 0
@.str.8 = [41 x i8] c"Please enter the file name of fragment:\0A\00"
@.str.9 = [16 x i8] c"#%dth fragment\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.10 = [31 x i8] c"Total CPU decoding time: %fms\0A\00"
@.str.11 = [37 x i8] c"Enter the name of the decoded file:\0A\00"
@.str.12 = [3 x i8] c"wb\00"
define void @decode_file(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i32
%22 = alloca i32*
%23 = alloca [100 x i8]
%24 = alloca i32
%25 = alloca [100 x i8]
%26 = alloca i32
%27 = alloca %struct.timespec
%28 = alloca %struct.timespec
%29 = alloca double
%30 = alloca i8*
%31 = alloca [100 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 1, i32* %9
%32 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %32, i32** %15
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %37
34: ; preds = %4
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @exit(i32 0)
unreachable
37: ; preds = %4
%38 = load i32*, i32** %15
%39 = call i32 (i32*, i8*, ...) @fscanf(i32* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %10)
%40 = load i32*, i32** %15
%41 = call i32 (i32*, i8*, ...) @fscanf(i32* %40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %8, i32* %7)
%42 = load i32, i32* %10
%43 = load i32, i32* %7
%44 = sdiv i32 %42, %43
%45 = load i32, i32* %10
%46 = load i32, i32* %7
%47 = srem i32 %45, %46
%48 = icmp ne i32 %47, 0
%49 = zext i1 %48 to i32
%50 = add nsw i32 %44, %49
store i32 %50, i32* %9
%51 = load i32, i32* %9
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %7
%54 = load i32, i32* %7
%55 = load i32, i32* %8
%56 = add nsw i32 %54, %55
%57 = mul nsw i32 %53, %56
store i32 %57, i32* %17
%58 = load i32, i32* %17
%59 = call i64 @malloc(i32 %58)
%60 = inttoptr i64 %59 to i8*
store i8* %60, i8** %19
%61 = load i32, i32* %7
%62 = load i32, i32* %7
%63 = mul nsw i32 %61, %62
store i32 %63, i32* %18
%64 = load i32, i32* %18
%65 = call i64 @malloc(i32 %64)
%66 = inttoptr i64 %65 to i8*
store i8* %66, i8** %20
store i32 0, i32* %21
br label %67
67: ; preds = %82, %37
%68 = load i32, i32* %21
%69 = load i32, i32* %7
%70 = load i32, i32* %7
%71 = load i32, i32* %8
%72 = add nsw i32 %70, %71
%73 = mul nsw i32 %69, %72
%74 = icmp slt i32 %68, %73
br i1 %74, label %75, label %85
75: ; preds = %67
%76 = load i32*, i32** %15
%77 = load i8*, i8** %19
%78 = load i32, i32* %21
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %77, i64 %79
%81 = call i32 (i32*, i8*, ...) @fscanf(i32* %76, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %80)
br label %82
82: ; preds = %75
%83 = load i32, i32* %21
%84 = add nsw i32 %83, 1
store i32 %84, i32* %21
br label %67
85: ; preds = %67
%86 = load i32, i32* %7
%87 = load i32, i32* %9
%88 = mul nsw i32 %86, %87
%89 = sext i32 %88 to i64
%90 = mul i64 %89, 1
%91 = trunc i64 %90 to i32
store i32 %91, i32* %13
%92 = load i32, i32* %7
%93 = load i32, i32* %9
%94 = mul nsw i32 %92, %93
%95 = sext i32 %94 to i64
%96 = mul i64 %95, 1
%97 = trunc i64 %96 to i32
store i32 %97, i32* %14
%98 = load i32, i32* %13
%99 = call i64 @malloc(i32 %98)
%100 = inttoptr i64 %99 to i8*
store i8* %100, i8** %11
%101 = load i8*, i8** %11
%102 = load i32, i32* %13
%103 = call i32 @memset(i8* %101, i32 0, i32 %102)
%104 = load i32, i32* %14
%105 = call i64 @malloc(i32 %104)
%106 = inttoptr i64 %105 to i8*
store i8* %106, i8** %12
%107 = load i8*, i8** %12
%108 = load i32, i32* %14
%109 = call i32 @memset(i8* %107, i32 0, i32 %108)
%110 = load i8*, i8** %5
%111 = icmp ne i8* %110, null
br i1 %111, label %112, label %154
112: ; preds = %85
%113 = load i8*, i8** %5
%114 = call i32* @fopen(i8* %113, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %114, i32** %22
store i32 0, i32* %21
br label %115
115: ; preds = %148, %112
%116 = load i32, i32* %21
%117 = load i32, i32* %7
%118 = icmp slt i32 %116, %117
br i1 %118, label %119, label %151
119: ; preds = %115
%120 = load i32*, i32** %22
%121 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%122 = call i32 (i32*, i8*, ...) @fscanf(i32* %120, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %121)
%123 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%124 = getelementptr inbounds i8, i8* %123, i64 1
%125 = call i32 @atoi(i8* %124)
store i32 %125, i32* %24
%126 = load i8*, i8** %19
%127 = load i8*, i8** %20
%128 = load i32, i32* %24
%129 = load i32, i32* %21
%130 = load i32, i32* %7
%131 = call i32 @copy_matrix(i8* %126, i8* %127, i32 %128, i32 %129, i32 %130)
%132 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%133 = call i32* @fopen(i8* %132, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %133, i32** %15
%134 = load i32*, i32** %15
%135 = load i32, i32* @SEEK_SET
%136 = call i32 @fseek(i32* %134, i64 0, i32 %135)
%137 = load i8*, i8** %12
%138 = load i32, i32* %21
%139 = load i32, i32* %9
%140 = mul nsw i32 %138, %139
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %137, i64 %141
%143 = load i32, i32* %9
%144 = load i32*, i32** %15
%145 = call i32 @fread(i8* %142, i32 1, i32 %143, i32* %144)
%146 = load i32*, i32** %15
%147 = call i32 @fclose(i32* %146)
br label %148
148: ; preds = %119
%149 = load i32, i32* %21
%150 = add nsw i32 %149, 1
store i32 %150, i32* %21
br label %115
151: ; preds = %115
%152 = load i32*, i32** %22
%153 = call i32 @fclose(i32* %152)
br label %194
154: ; preds = %85
store i32 0, i32* %21
br label %155
155: ; preds = %190, %154
%156 = load i32, i32* %21
%157 = load i32, i32* %7
%158 = icmp slt i32 %156, %157
br i1 %158, label %159, label %193
159: ; preds = %155
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
%161 = getelementptr inbounds [100 x i8], [100 x i8]* %25, i64 0, i64 0
%162 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %161)
%163 = getelementptr inbounds [100 x i8], [100 x i8]* %25, i64 0, i64 0
%164 = getelementptr inbounds i8, i8* %163, i64 1
%165 = call i32 @atoi(i8* %164)
store i32 %165, i32* %26
%166 = load i32, i32* %26
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %166)
%168 = load i8*, i8** %19
%169 = load i8*, i8** %20
%170 = load i32, i32* %26
%171 = load i32, i32* %21
%172 = load i32, i32* %7
%173 = call i32 @copy_matrix(i8* %168, i8* %169, i32 %170, i32 %171, i32 %172)
%174 = getelementptr inbounds [100 x i8], [100 x i8]* %25, i64 0, i64 0
%175 = call i32* @fopen(i8* %174, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %175, i32** %15
%176 = load i32*, i32** %15
%177 = load i32, i32* @SEEK_SET
%178 = call i32 @fseek(i32* %176, i64 0, i32 %177)
%179 = load i8*, i8** %12
%180 = load i32, i32* %21
%181 = load i32, i32* %9
%182 = mul nsw i32 %180, %181
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds i8, i8* %179, i64 %183
%185 = load i32, i32* %9
%186 = load i32*, i32** %15
%187 = call i32 @fread(i8* %184, i32 1, i32 %185, i32* %186)
%188 = load i32*, i32** %15
%189 = call i32 @fclose(i32* %188)
br label %190
190: ; preds = %159
%191 = load i32, i32* %21
%192 = add nsw i32 %191, 1
store i32 %192, i32* %21
br label %155
193: ; preds = %155
br label %194
194: ; preds = %193, %151
%195 = load i32, i32* @CLOCK_REALTIME
%196 = call i32 @clock_gettime(i32 %195, %struct.timespec* %27)
%197 = load i32, i32* %18
%198 = call i64 @malloc(i32 %197)
%199 = inttoptr i64 %198 to i8*
store i8* %199, i8** %30
%200 = load i8*, i8** %20
%201 = load i8*, i8** %30
%202 = load i32, i32* %7
%203 = call i32 @invert_matrix(i8* %200, i8* %201, i32 %202)
%204 = load i8*, i8** %11
%205 = load i8*, i8** %30
%206 = load i8*, i8** %12
%207 = load i32, i32* %7
%208 = load i32, i32* %8
%209 = load i32, i32* %9
%210 = call i32 @decode_chunk(i8* %204, i8* %205, i8* %206, i32 %207, i32 %208, i32 %209)
%211 = load i32, i32* @CLOCK_REALTIME
%212 = call i32 @clock_gettime(i32 %211, %struct.timespec* %28)
%213 = getelementptr inbounds %struct.timespec, %struct.timespec* %28, i32 0, i32 1
%214 = load i64, i64* %213
%215 = getelementptr inbounds %struct.timespec, %struct.timespec* %27, i32 0, i32 1
%216 = load i64, i64* %215
%217 = sub nsw i64 %214, %216
%218 = sitofp i64 %217 to double
%219 = getelementptr inbounds %struct.timespec, %struct.timespec* %28, i32 0, i32 0
%220 = load i64, i64* %219
%221 = getelementptr inbounds %struct.timespec, %struct.timespec* %27, i32 0, i32 0
%222 = load i64, i64* %221
%223 = sub nsw i64 %220, %222
%224 = sitofp i64 %223 to double
%225 = fdiv double %224, 1.000000e+06
%226 = call double @llvm.fmuladd.f64(double %218, double 1.000000e+03, double %225)
store double %226, double* %29
%227 = load double, double* %29
%228 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), double %227)
%229 = load i8*, i8** %6
%230 = icmp eq i8* %229, null
br i1 %230, label %231, label %237
231: ; preds = %194
%232 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0))
%233 = getelementptr inbounds [100 x i8], [100 x i8]* %31, i64 0, i64 0
%234 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %233)
%235 = getelementptr inbounds [100 x i8], [100 x i8]* %31, i64 0, i64 0
%236 = call i32* @fopen(i8* %235, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
store i32* %236, i32** %16
br label %240
237: ; preds = %194
%238 = load i8*, i8** %6
%239 = call i32* @fopen(i8* %238, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
store i32* %239, i32** %16
br label %240
240: ; preds = %237, %231
%241 = load i8*, i8** %11
%242 = load i32, i32* %10
%243 = load i32*, i32** %16
%244 = call i32 @fwrite(i8* %241, i32 1, i32 %242, i32* %243)
%245 = load i32*, i32** %16
%246 = call i32 @fclose(i32* %245)
%247 = load i8*, i8** %11
%248 = call i32 @free(i8* %247)
%249 = load i8*, i8** %12
%250 = call i32 @free(i8* %249)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@.str = [10 x i8] c".METADATA\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [16 x i8] c"chunk size: %d\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [3 x i8] c"%s\00"
@SEEK_SET = global i32 0
@.str.9 = [16 x i8] c"#%dth fragment\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.10 = [31 x i8] c"Total CPU decoding time: %fms\0A\00"
@.str.12 = [3 x i8] c"wb\00"
@str = [36 x i8] c"Enter the name of the decoded file:\00"
@str.13 = [40 x i8] c"Please enter the file name of fragment:\00"
@str.14 = [26 x i8] c"Can not open source file!\00"
define void @decode_file(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca %struct.timespec
%11 = alloca %struct.timespec
%12 = alloca [100 x i8]
store i32 %2, i32* %5
store i32 %3, i32* %6
%13 = bitcast i32* %7 to i8*
%14 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %4
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.14, i64 0, i64 0))
%18 = tail call i32 @exit(i32 0)
unreachable
19: ; preds = %4
%20 = call i32 (i32*, i8*, ...) @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %7)
%21 = call i32 (i32*, i8*, ...) @fscanf(i32* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %6, i32* %5)
%22 = load i32, i32* %7
%23 = load i32, i32* %5
%24 = sdiv i32 %22, %23
%25 = srem i32 %22, %23
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i32
%28 = add nsw i32 %24, %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = add nsw i32 %31, %30
%33 = mul nsw i32 %32, %30
%34 = call i64 @malloc(i32 %33)
%35 = inttoptr i64 %34 to i8*
%36 = load i32, i32* %5
%37 = mul nsw i32 %36, %36
%38 = call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to i8*
%40 = load i32, i32* %5
%41 = load i32, i32* %6
%42 = add nsw i32 %41, %40
%43 = mul nsw i32 %42, %40
%44 = icmp sgt i32 %43, 0
br i1 %44, label %45, label %56
45: ; preds = %19, %45
%46 = phi i64 [ %49, %45 ], [ 0, %19 ]
%47 = getelementptr inbounds i8, i8* %35, i64 %46
%48 = call i32 (i32*, i8*, ...) @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %47)
%49 = add nuw nsw i64 %46, 1
%50 = load i32, i32* %5
%51 = load i32, i32* %6
%52 = add nsw i32 %51, %50
%53 = mul nsw i32 %52, %50
%54 = sext i32 %53 to i64
%55 = icmp slt i64 %49, %54
br i1 %55, label %45, label %56
56: ; preds = %45, %19
%57 = phi i32 [ %40, %19 ], [ %50, %45 ]
%58 = mul nsw i32 %57, %28
%59 = call i64 @malloc(i32 %58)
%60 = inttoptr i64 %59 to i8*
%61 = call i32 @memset(i8* %60, i32 0, i32 %58)
%62 = call i64 @malloc(i32 %58)
%63 = inttoptr i64 %62 to i8*
%64 = call i32 @memset(i8* %63, i32 0, i32 %58)
%65 = icmp eq i8* %0, null
br i1 %65, label %66, label %73
66: ; preds = %56
%67 = load i32, i32* %5
%68 = icmp sgt i32 %67, 0
br i1 %68, label %69, label %121
69: ; preds = %66
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%71 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 1
%72 = sext i32 %28 to i64
br label %101
73: ; preds = %56
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%75 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%76 = load i32, i32* %5
%77 = icmp sgt i32 %76, 0
br i1 %77, label %78, label %99
78: ; preds = %73
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 1
%80 = sext i32 %28 to i64
br label %81
81: ; preds = %78, %81
%82 = phi i64 [ 0, %78 ], [ %95, %81 ]
%83 = call i32 (i32*, i8*, ...) @fscanf(i32* %75, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %74)
%84 = call i32 @atoi(i8* %79)
%85 = load i32, i32* %5
%86 = trunc i64 %82 to i32
%87 = call i32 @copy_matrix(i8* %35, i8* %39, i32 %84, i32 %86, i32 %85)
%88 = call i32* @fopen(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%89 = load i32, i32* @SEEK_SET
%90 = call i32 @fseek(i32* %88, i64 0, i32 %89)
%91 = mul nsw i64 %82, %80
%92 = getelementptr inbounds i8, i8* %63, i64 %91
%93 = call i32 @fread(i8* %92, i32 1, i32 %28, i32* %88)
%94 = call i32 @fclose(i32* %88)
%95 = add nuw nsw i64 %82, 1
%96 = load i32, i32* %5
%97 = sext i32 %96 to i64
%98 = icmp slt i64 %95, %97
br i1 %98, label %81, label %99
99: ; preds = %81, %73
%100 = call i32 @fclose(i32* %75)
br label %121
101: ; preds = %69, %101
%102 = phi i64 [ 0, %69 ], [ %117, %101 ]
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.13, i64 0, i64 0))
%104 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %70)
%105 = call i32 @atoi(i8* %71)
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %105)
%107 = load i32, i32* %5
%108 = trunc i64 %102 to i32
%109 = call i32 @copy_matrix(i8* %35, i8* %39, i32 %105, i32 %108, i32 %107)
%110 = call i32* @fopen(i8* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%111 = load i32, i32* @SEEK_SET
%112 = call i32 @fseek(i32* %110, i64 0, i32 %111)
%113 = mul nsw i64 %102, %72
%114 = getelementptr inbounds i8, i8* %63, i64 %113
%115 = call i32 @fread(i8* %114, i32 1, i32 %28, i32* %110)
%116 = call i32 @fclose(i32* %110)
%117 = add nuw nsw i64 %102, 1
%118 = load i32, i32* %5
%119 = sext i32 %118 to i64
%120 = icmp slt i64 %117, %119
br i1 %120, label %101, label %121
121: ; preds = %101, %66, %99
%122 = bitcast %struct.timespec* %10 to i8*
%123 = bitcast %struct.timespec* %11 to i8*
%124 = load i32, i32* @CLOCK_REALTIME
%125 = call i32 @clock_gettime(i32 %124, %struct.timespec* %10)
%126 = call i64 @malloc(i32 %37)
%127 = inttoptr i64 %126 to i8*
%128 = load i32, i32* %5
%129 = call i32 @invert_matrix(i8* %39, i8* %127, i32 %128)
%130 = load i32, i32* %5
%131 = load i32, i32* %6
%132 = call i32 @decode_chunk(i8* %60, i8* %127, i8* %63, i32 %130, i32 %131, i32 %28)
%133 = load i32, i32* @CLOCK_REALTIME
%134 = call i32 @clock_gettime(i32 %133, %struct.timespec* %11)
%135 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i64 0, i32 1
%136 = load i64, i64* %135
%137 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i64 0, i32 1
%138 = load i64, i64* %137
%139 = sub nsw i64 %136, %138
%140 = sitofp i64 %139 to double
%141 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i64 0, i32 0
%142 = load i64, i64* %141
%143 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i64 0, i32 0
%144 = load i64, i64* %143
%145 = sub nsw i64 %142, %144
%146 = sitofp i64 %145 to double
%147 = fdiv double %146, 1.000000e+06
%148 = call double @llvm.fmuladd.f64(double %140, double 1.000000e+03, double %147)
%149 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), double %148)
%150 = icmp eq i8* %1, null
br i1 %150, label %151, label %156
151: ; preds = %121
%152 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%153 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%154 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %152)
%155 = call i32* @fopen(i8* %152, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
br label %158
156: ; preds = %121
%157 = call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
br label %158
158: ; preds = %156, %151
%159 = phi i32* [ %155, %151 ], [ %157, %156 ]
%160 = load i32, i32* %7
%161 = call i32 @fwrite(i8* %60, i32 1, i32 %160, i32* %159)
%162 = call i32 @fclose(i32* %159)
%163 = call i32 @free(i8* %60)
%164 = call i32 @free(i8* %63)
ret void
}