#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);
  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    -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    133b <decode_file+0x12b>
mov    -0x40(%rbp),%rdi
mov    -0x58(%rbp),%rdx
movslq -0x64(%rbp),%rax
add    %rax,%rdx
lea    0xd15(%rip),%rsi
mov    $0x0,%al
call   10a0 <fscanf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12f9 <decode_file+0xe9>
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     147d <decode_file+0x26d>
mov    -0x8(%rbp),%rdi
lea    0xc99(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    146f <decode_file+0x25f>
mov    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rdx
lea    0xc6d(%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    0xc02(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x2bb4(%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    13b5 <decode_file+0x1a5>
mov    -0x70(%rbp),%rdi
call   1060 <fclose@plt>
jmp    155f <decode_file+0x34f>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    155a <decode_file+0x34a>
lea    0xbac(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x150(%rbp),%rsi
lea    0xb94(%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    0xb98(%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    0xb17(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x2ac9(%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    1484 <decode_file+0x274>
jmp    155f <decode_file+0x34f>
mov    0x2a72(%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    0x2a1c(%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  0xa10(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0x9fc(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x180(%rbp)
ff
movsd  -0x180(%rbp),%xmm0
ff
lea    0xa59(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1672 <decode_file+0x462>
lea    0xa5f(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x1f0(%rbp),%rsi
lea    0x9ef(%rip),%rdi
call   10e0 <scanf@plt>
lea    -0x1f0(%rbp),%rdi
lea    0xa5c(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x48(%rbp)
jmp    1686 <decode_file+0x476>
mov    -0x10(%rbp),%rdi
lea    0xa43(%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,0x30(%rsp)
mov    %edx,(%rsp)
mov    %ecx,0x8(%rsp)
lea    0xdc7(%rip),%rdi
lea    0xdca(%rip),%rsi
call   1110 <fopen@plt>
test   %rax,%rax
je     1606 <decode_file+0x3e6>
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
mov    (%rsp),%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
mov    %eax,0x4(%rsp)
mov    0x8(%rsp),%edi
add    %ecx,%edi
imul   %ecx,%edi
call   10d0 <malloc@plt>
mov    %rax,%r14
mov    (%rsp),%edi
imul   %edi,%edi
mov    %edi,0x24(%rsp)
call   10d0 <malloc@plt>
mov    %rax,%r15
mov    (%rsp),%ebx
mov    0x8(%rsp),%eax
add    %ebx,%eax
imul   %ebx,%eax
test   %eax,%eax
jle    1308 <decode_file+0xe8>
lea    0xd42(%rip),%r13
xor    %ebp,%ebp
lea    (%r14,%rbp,1),%rdx
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10b0 <fscanf@plt>
add    $0x1,%rbp
mov    (%rsp),%ebx
mov    0x8(%rsp),%eax
add    %ebx,%eax
imul   %ebx,%eax
cltq
cmp    %rax,%rbp
jl     12e0 <decode_file+0xc0>
imul   0x4(%rsp),%ebx
mov    %ebx,%edi
call   10d0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   10a0 <memset@plt>
mov    %ebx,%edi
call   10d0 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   10a0 <memset@plt>
mov    0x30(%rsp),%rdi
test   %rdi,%rdi
mov    %rbp,0x28(%rsp)
mov    %r15,0x18(%rsp)
je     1419 <decode_file+0x1f9>
lea    0xcc9(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rdi
cmpl   $0x0,(%rsp)
jle    140f <decode_file+0x1ef>
movslq 0x4(%rsp),%rbx
mov    0x10(%rsp),%r12
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    %rdi,%r15
lea    0xc9b(%rip),%rsi
lea    0x60(%rsp),%rbp
mov    %rbp,%rdx
xor    %eax,%eax
call   10b0 <fscanf@plt>
lea    0x61(%rsp),%rdi
call   1120 <atoi@plt>
mov    (%rsp),%r8d
mov    %r14,%rdi
mov    0x18(%rsp),%rsi
mov    %eax,%edx
mov    %r13d,%ecx
call   1100 <copy_matrix@plt>
mov    %rbp,%rdi
lea    0xc57(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbp
mov    0x2c0e(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10e0 <fseek@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
mov    %rbp,%rdi
call   1070 <fclose@plt>
mov    %r15,%rdi
add    $0x1,%r13
movslq (%rsp),%rax
add    %rbx,%r12
cmp    %rax,%r13
jl     1380 <decode_file+0x160>
call   1070 <fclose@plt>
jmp    14e1 <decode_file+0x2c1>
cmpl   $0x0,(%rsp)
jle    14e1 <decode_file+0x2c1>
movslq 0x4(%rsp),%r13
lea    0x60(%rsp),%r15
mov    0x10(%rsp),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xc37(%rip),%rdi
call   1040 <puts@plt>
lea    0xbd2(%rip),%rdi
mov    %r15,%rsi
call   10f0 <scanf@plt>
lea    0x61(%rsp),%rdi
call   1120 <atoi@plt>
mov    %eax,%ebp
lea    0xbba(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    (%rsp),%r8d
mov    %r14,%rdi
mov    0x18(%rsp),%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1100 <copy_matrix@plt>
mov    %r15,%rdi
lea    0xb84(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbp
mov    0x2b3b(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10e0 <fseek@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    0x4(%rsp),%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
mov    %rbp,%rdi
call   1070 <fclose@plt>
add    $0x1,%rbx
movslq (%rsp),%rax
add    %r13,%r12
cmp    %rax,%rbx
jl     1440 <decode_file+0x220>
mov    0x2af0(%rip),%r14
mov    (%r14),%edi
lea    0x50(%rsp),%rsi
call   1060 <clock_gettime@plt>
mov    0x24(%rsp),%edi
call   10d0 <malloc@plt>
mov    %rax,%rbx
mov    (%rsp),%edx
mov    0x18(%rsp),%rdi
mov    %rax,%rsi
call   10c0 <invert_matrix@plt>
mov    (%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    0x28(%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  0xa97(%rip),%xmm1
mulsd  0xa97(%rip),%xmm0
addsd  %xmm1,%xmm0
lea    0xabc(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
mov    0x38(%rsp),%rdi
test   %rdi,%rdi
je     1596 <decode_file+0x376>
lea    0xac3(%rip),%rsi
jmp    15c0 <decode_file+0x3a0>
lea    0xabd(%rip),%rdi
call   1040 <puts@plt>
lea    0xa7c(%rip),%rdi
lea    0x60(%rsp),%rbx
mov    %rbx,%rsi
call   10f0 <scanf@plt>
lea    0xa9a(%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    0xa99(%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 = [2 x i8] c"r\00"
@.str.6 = [3 x i8] c"%s\00"
@SEEK_SET = global i32 0
@.str.7 = [41 x i8] c"Please enter the file name of fragment:\0A\00"
@.str.8 = [16 x i8] c"#%dth fragment\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.9 = [31 x i8] c"Total CPU decoding time: %fms\0A\00"
@.str.10 = [37 x i8] c"Enter the name of the decoded file:\0A\00"
@.str.11 = [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* %7
%52 = load i32, i32* %7
%53 = load i32, i32* %8
%54 = add nsw i32 %52, %53
%55 = mul nsw i32 %51, %54
store i32 %55, i32* %17
%56 = load i32, i32* %17
%57 = call i64 @malloc(i32 %56)
%58 = inttoptr i64 %57 to i8*
store i8* %58, i8** %19
%59 = load i32, i32* %7
%60 = load i32, i32* %7
%61 = mul nsw i32 %59, %60
store i32 %61, i32* %18
%62 = load i32, i32* %18
%63 = call i64 @malloc(i32 %62)
%64 = inttoptr i64 %63 to i8*
store i8* %64, i8** %20
store i32 0, i32* %21
br label %65
65: ; preds = %80, %37
%66 = load i32, i32* %21
%67 = load i32, i32* %7
%68 = load i32, i32* %7
%69 = load i32, i32* %8
%70 = add nsw i32 %68, %69
%71 = mul nsw i32 %67, %70
%72 = icmp slt i32 %66, %71
br i1 %72, label %73, label %83
73: ; preds = %65
%74 = load i32*, i32** %15
%75 = load i8*, i8** %19
%76 = load i32, i32* %21
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = call i32 (i32*, i8*, ...) @fscanf(i32* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %78)
br label %80
80: ; preds = %73
%81 = load i32, i32* %21
%82 = add nsw i32 %81, 1
store i32 %82, i32* %21
br label %65
83: ; preds = %65
%84 = load i32, i32* %7
%85 = load i32, i32* %9
%86 = mul nsw i32 %84, %85
%87 = sext i32 %86 to i64
%88 = mul i64 %87, 1
%89 = trunc i64 %88 to i32
store i32 %89, i32* %13
%90 = load i32, i32* %7
%91 = load i32, i32* %9
%92 = mul nsw i32 %90, %91
%93 = sext i32 %92 to i64
%94 = mul i64 %93, 1
%95 = trunc i64 %94 to i32
store i32 %95, i32* %14
%96 = load i32, i32* %13
%97 = call i64 @malloc(i32 %96)
%98 = inttoptr i64 %97 to i8*
store i8* %98, i8** %11
%99 = load i8*, i8** %11
%100 = load i32, i32* %13
%101 = call i32 @memset(i8* %99, i32 0, i32 %100)
%102 = load i32, i32* %14
%103 = call i64 @malloc(i32 %102)
%104 = inttoptr i64 %103 to i8*
store i8* %104, i8** %12
%105 = load i8*, i8** %12
%106 = load i32, i32* %14
%107 = call i32 @memset(i8* %105, i32 0, i32 %106)
%108 = load i8*, i8** %5
%109 = icmp ne i8* %108, null
br i1 %109, label %110, label %152
110: ; preds = %83
%111 = load i8*, i8** %5
%112 = call i32* @fopen(i8* %111, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %112, i32** %22
store i32 0, i32* %21
br label %113
113: ; preds = %146, %110
%114 = load i32, i32* %21
%115 = load i32, i32* %7
%116 = icmp slt i32 %114, %115
br i1 %116, label %117, label %149
117: ; preds = %113
%118 = load i32*, i32** %22
%119 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%120 = call i32 (i32*, i8*, ...) @fscanf(i32* %118, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %119)
%121 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%122 = getelementptr inbounds i8, i8* %121, i64 1
%123 = call i32 @atoi(i8* %122)
store i32 %123, i32* %24
%124 = load i8*, i8** %19
%125 = load i8*, i8** %20
%126 = load i32, i32* %24
%127 = load i32, i32* %21
%128 = load i32, i32* %7
%129 = call i32 @copy_matrix(i8* %124, i8* %125, i32 %126, i32 %127, i32 %128)
%130 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%131 = call i32* @fopen(i8* %130, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %131, i32** %15
%132 = load i32*, i32** %15
%133 = load i32, i32* @SEEK_SET
%134 = call i32 @fseek(i32* %132, i64 0, i32 %133)
%135 = load i8*, i8** %12
%136 = load i32, i32* %21
%137 = load i32, i32* %9
%138 = mul nsw i32 %136, %137
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i8, i8* %135, i64 %139
%141 = load i32, i32* %9
%142 = load i32*, i32** %15
%143 = call i32 @fread(i8* %140, i32 1, i32 %141, i32* %142)
%144 = load i32*, i32** %15
%145 = call i32 @fclose(i32* %144)
br label %146
146: ; preds = %117
%147 = load i32, i32* %21
%148 = add nsw i32 %147, 1
store i32 %148, i32* %21
br label %113
149: ; preds = %113
%150 = load i32*, i32** %22
%151 = call i32 @fclose(i32* %150)
br label %192
152: ; preds = %83
store i32 0, i32* %21
br label %153
153: ; preds = %188, %152
%154 = load i32, i32* %21
%155 = load i32, i32* %7
%156 = icmp slt i32 %154, %155
br i1 %156, label %157, label %191
157: ; preds = %153
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%159 = getelementptr inbounds [100 x i8], [100 x i8]* %25, i64 0, i64 0
%160 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %159)
%161 = getelementptr inbounds [100 x i8], [100 x i8]* %25, i64 0, i64 0
%162 = getelementptr inbounds i8, i8* %161, i64 1
%163 = call i32 @atoi(i8* %162)
store i32 %163, i32* %26
%164 = load i32, i32* %26
%165 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 %164)
%166 = load i8*, i8** %19
%167 = load i8*, i8** %20
%168 = load i32, i32* %26
%169 = load i32, i32* %21
%170 = load i32, i32* %7
%171 = call i32 @copy_matrix(i8* %166, i8* %167, i32 %168, i32 %169, i32 %170)
%172 = getelementptr inbounds [100 x i8], [100 x i8]* %25, i64 0, i64 0
%173 = call i32* @fopen(i8* %172, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %173, i32** %15
%174 = load i32*, i32** %15
%175 = load i32, i32* @SEEK_SET
%176 = call i32 @fseek(i32* %174, i64 0, i32 %175)
%177 = load i8*, i8** %12
%178 = load i32, i32* %21
%179 = load i32, i32* %9
%180 = mul nsw i32 %178, %179
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds i8, i8* %177, i64 %181
%183 = load i32, i32* %9
%184 = load i32*, i32** %15
%185 = call i32 @fread(i8* %182, i32 1, i32 %183, i32* %184)
%186 = load i32*, i32** %15
%187 = call i32 @fclose(i32* %186)
br label %188
188: ; preds = %157
%189 = load i32, i32* %21
%190 = add nsw i32 %189, 1
store i32 %190, i32* %21
br label %153
191: ; preds = %153
br label %192
192: ; preds = %191, %149
%193 = load i32, i32* @CLOCK_REALTIME
%194 = call i32 @clock_gettime(i32 %193, %struct.timespec* %27)
%195 = load i32, i32* %18
%196 = call i64 @malloc(i32 %195)
%197 = inttoptr i64 %196 to i8*
store i8* %197, i8** %30
%198 = load i8*, i8** %20
%199 = load i8*, i8** %30
%200 = load i32, i32* %7
%201 = call i32 @invert_matrix(i8* %198, i8* %199, i32 %200)
%202 = load i8*, i8** %11
%203 = load i8*, i8** %30
%204 = load i8*, i8** %12
%205 = load i32, i32* %7
%206 = load i32, i32* %8
%207 = load i32, i32* %9
%208 = call i32 @decode_chunk(i8* %202, i8* %203, i8* %204, i32 %205, i32 %206, i32 %207)
%209 = load i32, i32* @CLOCK_REALTIME
%210 = call i32 @clock_gettime(i32 %209, %struct.timespec* %28)
%211 = getelementptr inbounds %struct.timespec, %struct.timespec* %28, i32 0, i32 1
%212 = load i64, i64* %211
%213 = getelementptr inbounds %struct.timespec, %struct.timespec* %27, i32 0, i32 1
%214 = load i64, i64* %213
%215 = sub nsw i64 %212, %214
%216 = sitofp i64 %215 to double
%217 = getelementptr inbounds %struct.timespec, %struct.timespec* %28, i32 0, i32 0
%218 = load i64, i64* %217
%219 = getelementptr inbounds %struct.timespec, %struct.timespec* %27, i32 0, i32 0
%220 = load i64, i64* %219
%221 = sub nsw i64 %218, %220
%222 = sitofp i64 %221 to double
%223 = fdiv double %222, 1.000000e+06
%224 = call double @llvm.fmuladd.f64(double %216, double 1.000000e+03, double %223)
store double %224, double* %29
%225 = load double, double* %29
%226 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), double %225)
%227 = load i8*, i8** %6
%228 = icmp eq i8* %227, null
br i1 %228, label %229, label %235
229: ; preds = %192
%230 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
%231 = getelementptr inbounds [100 x i8], [100 x i8]* %31, i64 0, i64 0
%232 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %231)
%233 = getelementptr inbounds [100 x i8], [100 x i8]* %31, i64 0, i64 0
%234 = call i32* @fopen(i8* %233, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
store i32* %234, i32** %16
br label %238
235: ; preds = %192
%236 = load i8*, i8** %6
%237 = call i32* @fopen(i8* %236, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
store i32* %237, i32** %16
br label %238
238: ; preds = %235, %229
%239 = load i8*, i8** %11
%240 = load i32, i32* %10
%241 = load i32*, i32** %16
%242 = call i32 @fwrite(i8* %239, i32 1, i32 %240, i32* %241)
%243 = load i32*, i32** %16
%244 = call i32 @fclose(i32* %243)
%245 = load i8*, i8** %11
%246 = call i32 @free(i8* %245)
%247 = load i8*, i8** %12
%248 = call i32 @free(i8* %247)
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 = [2 x i8] c"r\00"
@.str.6 = [3 x i8] c"%s\00"
@SEEK_SET = global i32 0
@.str.8 = [16 x i8] c"#%dth fragment\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.9 = [31 x i8] c"Total CPU decoding time: %fms\0A\00"
@.str.11 = [3 x i8] c"wb\00"
@str = [36 x i8] c"Enter the name of the decoded file:\00"
@str.12 = [40 x i8] c"Please enter the file name of fragment:\00"
@str.13 = [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.13, 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 = load i32, i32* %6
%30 = add nsw i32 %29, %23
%31 = mul nsw i32 %30, %23
%32 = call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to i8*
%34 = load i32, i32* %5
%35 = mul nsw i32 %34, %34
%36 = call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to i8*
%38 = load i32, i32* %5
%39 = load i32, i32* %6
%40 = add nsw i32 %39, %38
%41 = mul nsw i32 %40, %38
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %54
43: ; preds = %19, %43
%44 = phi i64 [ %47, %43 ], [ 0, %19 ]
%45 = getelementptr inbounds i8, i8* %33, i64 %44
%46 = call i32 (i32*, i8*, ...) @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %45)
%47 = add nuw nsw i64 %44, 1
%48 = load i32, i32* %5
%49 = load i32, i32* %6
%50 = add nsw i32 %49, %48
%51 = mul nsw i32 %50, %48
%52 = sext i32 %51 to i64
%53 = icmp slt i64 %47, %52
br i1 %53, label %43, label %54
54: ; preds = %43, %19
%55 = phi i32 [ %38, %19 ], [ %48, %43 ]
%56 = mul nsw i32 %55, %28
%57 = call i64 @malloc(i32 %56)
%58 = inttoptr i64 %57 to i8*
%59 = call i32 @memset(i8* %58, i32 0, i32 %56)
%60 = call i64 @malloc(i32 %56)
%61 = inttoptr i64 %60 to i8*
%62 = call i32 @memset(i8* %61, i32 0, i32 %56)
%63 = icmp eq i8* %0, null
br i1 %63, label %64, label %71
64: ; preds = %54
%65 = load i32, i32* %5
%66 = icmp sgt i32 %65, 0
br i1 %66, label %67, label %119
67: ; preds = %64
%68 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%69 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 1
%70 = sext i32 %28 to i64
br label %99
71: ; preds = %54
%72 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%73 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%74 = load i32, i32* %5
%75 = icmp sgt i32 %74, 0
br i1 %75, label %76, label %97
76: ; preds = %71
%77 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 1
%78 = sext i32 %28 to i64
br label %79
79: ; preds = %76, %79
%80 = phi i64 [ 0, %76 ], [ %93, %79 ]
%81 = call i32 (i32*, i8*, ...) @fscanf(i32* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %72)
%82 = call i32 @atoi(i8* %77)
%83 = load i32, i32* %5
%84 = trunc i64 %80 to i32
%85 = call i32 @copy_matrix(i8* %33, i8* %37, i32 %82, i32 %84, i32 %83)
%86 = call i32* @fopen(i8* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%87 = load i32, i32* @SEEK_SET
%88 = call i32 @fseek(i32* %86, i64 0, i32 %87)
%89 = mul nsw i64 %80, %78
%90 = getelementptr inbounds i8, i8* %61, i64 %89
%91 = call i32 @fread(i8* %90, i32 1, i32 %28, i32* %86)
%92 = call i32 @fclose(i32* %86)
%93 = add nuw nsw i64 %80, 1
%94 = load i32, i32* %5
%95 = sext i32 %94 to i64
%96 = icmp slt i64 %93, %95
br i1 %96, label %79, label %97
97: ; preds = %79, %71
%98 = call i32 @fclose(i32* %73)
br label %119
99: ; preds = %67, %99
%100 = phi i64 [ 0, %67 ], [ %115, %99 ]
%101 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.12, i64 0, i64 0))
%102 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %68)
%103 = call i32 @atoi(i8* %69)
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 %103)
%105 = load i32, i32* %5
%106 = trunc i64 %100 to i32
%107 = call i32 @copy_matrix(i8* %33, i8* %37, i32 %103, i32 %106, i32 %105)
%108 = call i32* @fopen(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%109 = load i32, i32* @SEEK_SET
%110 = call i32 @fseek(i32* %108, i64 0, i32 %109)
%111 = mul nsw i64 %100, %70
%112 = getelementptr inbounds i8, i8* %61, i64 %111
%113 = call i32 @fread(i8* %112, i32 1, i32 %28, i32* %108)
%114 = call i32 @fclose(i32* %108)
%115 = add nuw nsw i64 %100, 1
%116 = load i32, i32* %5
%117 = sext i32 %116 to i64
%118 = icmp slt i64 %115, %117
br i1 %118, label %99, label %119
119: ; preds = %99, %64, %97
%120 = bitcast %struct.timespec* %10 to i8*
%121 = bitcast %struct.timespec* %11 to i8*
%122 = load i32, i32* @CLOCK_REALTIME
%123 = call i32 @clock_gettime(i32 %122, %struct.timespec* %10)
%124 = call i64 @malloc(i32 %35)
%125 = inttoptr i64 %124 to i8*
%126 = load i32, i32* %5
%127 = call i32 @invert_matrix(i8* %37, i8* %125, i32 %126)
%128 = load i32, i32* %5
%129 = load i32, i32* %6
%130 = call i32 @decode_chunk(i8* %58, i8* %125, i8* %61, i32 %128, i32 %129, i32 %28)
%131 = load i32, i32* @CLOCK_REALTIME
%132 = call i32 @clock_gettime(i32 %131, %struct.timespec* %11)
%133 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i64 0, i32 1
%134 = load i64, i64* %133
%135 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i64 0, i32 1
%136 = load i64, i64* %135
%137 = sub nsw i64 %134, %136
%138 = sitofp i64 %137 to double
%139 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i64 0, i32 0
%140 = load i64, i64* %139
%141 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i64 0, i32 0
%142 = load i64, i64* %141
%143 = sub nsw i64 %140, %142
%144 = sitofp i64 %143 to double
%145 = fdiv double %144, 1.000000e+06
%146 = call double @llvm.fmuladd.f64(double %138, double 1.000000e+03, double %145)
%147 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), double %146)
%148 = icmp eq i8* %1, null
br i1 %148, label %149, label %154
149: ; preds = %119
%150 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%151 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%152 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %150)
%153 = call i32* @fopen(i8* %150, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %156
154: ; preds = %119
%155 = call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %156
156: ; preds = %154, %149
%157 = phi i32* [ %153, %149 ], [ %155, %154 ]
%158 = load i32, i32* %7
%159 = call i32 @fwrite(i8* %58, i32 1, i32 %158, i32* %157)
%160 = call i32 @fclose(i32* %157)
%161 = call i32 @free(i8* %58)
%162 = call i32 @free(i8* %61)
ret void
}