#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct TYPE_3__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct rusage {
  TYPE_2__ ru_utime;
  TYPE_1__ ru_stime;
};
typedef scalar_t__ clock_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ CLOCKS_PER_SEC;
int /*<<< orphan*/ RUSAGE_SELF;
long atol(char *);
scalar_t__ clock();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int getrusage(int /*<<< orphan*/, struct rusage *);
scalar_t__ lib_sort(char *, long);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strncmp(char *, char *, int);
scalar_t__ sys_sort(char *, long);
int main(int argc, char **argv) {
  if (argc != 4) {
    printf("Wrong number of arguments\n");
    return 0;
  }
  printf("Args:\n- Filename: %s\n- Record's size: %s\n- Type: %s\n", argv[1],
         argv[2], argv[3]);
  long record_size = atol(argv[2]);
  char *lib = "lib";
  char *sys = "sys";
  struct rusage mz_time;
  clock_t begin_time = clock();
  if (getrusage(RUSAGE_SELF, &mz_time) == -1) {
    goto error;
  }
  double begin_time_sys = ((double)mz_time.ru_stime.tv_sec * 1000.0) +
                          ((double)mz_time.ru_stime.tv_usec / 1000.0);
  double begin_time_user = ((double)mz_time.ru_utime.tv_sec * 1000.0) +
                           ((double)mz_time.ru_utime.tv_usec / 1000.0);
  if (strncmp(lib, argv[3], 3) == 0) {
    if (lib_sort(argv[1], record_size) != 0)
      goto error;
  } else if (strncmp(sys, argv[3], 3) == 0) {
    if (sys_sort(argv[1], record_size) != 0)
      goto error;
  }
  clock_t end_time = clock();
  if (getrusage(RUSAGE_SELF, &mz_time) == -1) {
    goto error;
  }
  double end_time_sys = ((double)mz_time.ru_stime.tv_sec * 1000.0) +
                        ((double)mz_time.ru_stime.tv_usec / 1000.0);
  double end_time_user = ((double)mz_time.ru_utime.tv_sec * 1000.0) +
                         ((double)mz_time.ru_utime.tv_usec / 1000.0);
  double real_time =
      (double)(end_time - begin_time) / ((double)CLOCKS_PER_SEC / 1000.0);
  double user_time = end_time_user - begin_time_user;
  double sys_time = end_time_sys - begin_time_sys;
  FILE *results = fopen("wyniki.txt", "a+");
  if (results == NULL)
    goto error;
  fprintf(results, "\n\n-------------------------------------------------------"
                   "------------------\n---------------------------------------"
                   "----------------------------------\n");
  fprintf(results, "Args:\n- Filename: %s\n- Record's size: %s\n- Type: %s\n",
          argv[1], argv[2], argv[3]);
  fprintf(results, "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
                   "++++++++++++++++\n");
  fprintf(results, "Times: \n- real: %lf ms\n- user: %lf ms\n- sys: %lf ms\n",
          real_time, user_time, sys_time);
  fprintf(results, "-----------------------------------------------------------"
                   "--------------\n");
  fclose(results);
  return 0;
error:
  perror("Error: ");
  exit(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11fd <main+0x3d>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1526 <main+0x366>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atol@plt>
mov    %rax,-0x18(%rbp)
lea    0xe1d(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe16(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x50(%rbp)
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   10b0 <getrusage@plt>
cmp    $0xffffffff,%eax
jne    1275 <main+0xb5>
jmp    1510 <main+0x350>
cvtsi2sdq -0x30(%rbp),%xmm0
cvtsi2sdq -0x38(%rbp),%xmm1
movsd  0xd77(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xd6b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
cvtsi2sdq -0x40(%rbp),%xmm0
cvtsi2sdq -0x48(%rbp),%xmm1
movsd  0xd4a(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xd3e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1314 <main+0x154>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rsi
call   10e0 <lib_sort@plt>
cmp    $0x0,%rax
je     130f <main+0x14f>
jmp    1510 <main+0x350>
jmp    135e <main+0x19e>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1359 <main+0x199>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <sys_sort@plt>
cmp    $0x0,%rax
je     1354 <main+0x194>
jmp    1510 <main+0x350>
jmp    1359 <main+0x199>
jmp    135e <main+0x19e>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x68(%rbp)
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   10b0 <getrusage@plt>
cmp    $0xffffffff,%eax
jne    1389 <main+0x1c9>
jmp    1510 <main+0x350>
cvtsi2sdq -0x30(%rbp),%xmm0
cvtsi2sdq -0x38(%rbp),%xmm1
movsd  0xc63(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xc57(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
cvtsi2sdq -0x40(%rbp),%xmm0
cvtsi2sdq -0x48(%rbp),%xmm1
movsd  0xc36(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xc2a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x68(%rbp),%rax
sub    -0x50(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2bf1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xbfc(%rip),%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
lea    0xc24(%rip),%rdi
lea    0xc28(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
jne    1462 <main+0x2a2>
jmp    1510 <main+0x350>
mov    -0x98(%rbp),%rdi
lea    0xbfe(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x98(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%r8
lea    0xb86(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x98(%rbp),%rdi
lea    0xc53(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x98(%rbp),%rdi
movsd  -0x80(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm2
ff
lea    0xc76(%rip),%rsi
mov    $0x3,%al
call   1080 <fprintf@plt>
mov    -0x98(%rbp),%rdi
lea    0xbc9(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x98(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1526 <main+0x366>
lea    0xc70(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x4,%edi
jne    12c8 <main+0xe8>
mov    %rsi,%r15
mov    0x8(%rsi),%rsi
mov    0x10(%r15),%rdx
mov    0x18(%r15),%rcx
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%r15),%rdi
call   10a0 <atol@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <clock@plt>
mov    %rax,0x10(%rsp)
mov    0x2da5(%rip),%r13
mov    0x0(%r13),%edi
lea    0x18(%rsp),%rsi
call   10c0 <getrusage@plt>
cmp    $0xffffffff,%eax
je     14a3 <main+0x2c3>
cvtsi2sdq 0x30(%rsp),%xmm0
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdq 0x28(%rsp),%xmm0
movsd  %xmm0,0x48(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdq 0x20(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdq 0x18(%rsp),%xmm0
movsd  %xmm0,0x50(%rsp)
mov    0x18(%r15),%rsi
lea    0xdac(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     12d9 <main+0xf9>
mov    0x18(%r15),%rsi
lea    0xd96(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12ee <main+0x10e>
mov    0x8(%r15),%rdi
mov    %rbx,%rsi
call   1050 <sys_sort@plt>
jmp    12e5 <main+0x105>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
jmp    1492 <main+0x2b2>
mov    0x8(%r15),%rdi
mov    %rbx,%rsi
call   1100 <lib_sort@plt>
test   %rax,%rax
jne    14a3 <main+0x2c3>
xor    %eax,%eax
call   1060 <clock@plt>
mov    %rax,%r12
mov    0x0(%r13),%edi
lea    0x18(%rsp),%rsi
call   10c0 <getrusage@plt>
cmp    $0xffffffff,%eax
je     14a3 <main+0x2c3>
mov    0x30(%rsp),%r13
mov    0x28(%rsp),%rbp
mov    0x18(%rsp),%rax
mov    %rax,0x38(%rsp)
mov    0x20(%rsp),%r14
mov    0x2cb9(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x40(%rsp)
lea    0xd07(%rip),%rdi
lea    0xd0b(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     14a3 <main+0x2c3>
mov    %rax,%rbx
movsd  0xca2(%rip),%xmm0
movsd  0x48(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  (%rsp),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
movsd  0x50(%rsp),%xmm4
divsd  %xmm0,%xmm4
movsd  0x8(%rsp),%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sd %r13,%xmm5
xorps  %xmm1,%xmm1
cvtsi2sd %rbp,%xmm1
addsd  %xmm4,%xmm2
divsd  %xmm0,%xmm1
movapd %xmm5,%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm1,%xmm4
xorps  %xmm5,%xmm5
cvtsi2sd %r14,%xmm5
xorps  %xmm1,%xmm1
cvtsi2sdq 0x38(%rsp),%xmm1
subsd  %xmm3,%xmm4
movsd  %xmm4,0x8(%rsp)
divsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm5
addsd  %xmm1,%xmm5
subsd  %xmm2,%xmm5
movsd  %xmm5,(%rsp)
sub    0x10(%rsp),%r12
xorps  %xmm2,%xmm2
cvtsi2sd %r12,%xmm2
xorps  %xmm1,%xmm1
cvtsi2sdq 0x40(%rsp),%xmm1
divsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
lea    0xc4c(%rip),%rdi
mov    $0x96,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10f0 <fwrite@plt>
mov    0x8(%r15),%rdx
mov    0x10(%r15),%rcx
mov    0x18(%r15),%r8
lea    0xbdc(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0xcad(%rip),%rdi
mov    $0x4c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xce1(%rip),%rsi
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mov    $0x3,%al
call   1090 <fprintf@plt>
lea    0xc27(%rip),%rdi
mov    $0x4a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
mov    %rbx,%rdi
call   1070 <fclose@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcc2(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@.str = [27 x i8] c"Wrong number of arguments\0A\00"
@.str.1 = [53 x i8] c"Args:\0A- Filename: %s\0A- Record's size: %s\0A- Type: %s\0A\00"
@.str.2 = [4 x i8] c"lib\00"
@.str.3 = [4 x i8] c"sys\00"
@RUSAGE_SELF = global i32 0
@CLOCKS_PER_SEC = global i64 0
@.str.4 = [11 x i8] c"wyniki.txt\00"
@.str.5 = [3 x i8] c"a+\00"
@.str.6 = [151 x i8] c"\0A\0A-------------------------------------------------------------------------\0A-------------------------------------------------------------------------\0A\00"
@.str.7 = [77 x i8] c"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\0A\00"
@.str.8 = [53 x i8] c"Times: \0A- real: %lf ms\0A- user: %lf ms\0A- sys: %lf ms\0A\00"
@.str.9 = [75 x i8] c"-------------------------------------------------------------------------\0A\00"
@.str.10 = [8 x i8] c"Error: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca %struct.rusage
%10 = alloca i64
%11 = alloca double
%12 = alloca double
%13 = alloca i64
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 4
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %170
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 3
%33 = load i8*, i8** %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8* %27, i8* %30, i8* %33)
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i64 @atol(i8* %37)
store i64 %38, i64* %6
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %8
%39 = call i64 (...) @clock()
store i64 %39, i64* %10
%40 = load i32, i32* @RUSAGE_SELF
%41 = call i32 @getrusage(i32 %40, %struct.rusage* %9)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %44
43: ; preds = %24
br label %167
44: ; preds = %24
%45 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 1
%46 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %45, i32 0, i32 1
%47 = load i64, i64* %46
%48 = sitofp i64 %47 to double
%49 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 1
%50 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %49, i32 0, i32 0
%51 = load i64, i64* %50
%52 = sitofp i64 %51 to double
%53 = fdiv double %52, 1.000000e+03
%54 = call double @llvm.fmuladd.f64(double %48, double 1.000000e+03, double %53)
store double %54, double* %11
%55 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 0
%56 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %55, i32 0, i32 1
%57 = load i64, i64* %56
%58 = sitofp i64 %57 to double
%59 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 0
%60 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %59, i32 0, i32 0
%61 = load i64, i64* %60
%62 = sitofp i64 %61 to double
%63 = fdiv double %62, 1.000000e+03
%64 = call double @llvm.fmuladd.f64(double %58, double 1.000000e+03, double %63)
store double %64, double* %12
%65 = load i8*, i8** %7
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 3
%68 = load i8*, i8** %67
%69 = call i64 @strncmp(i8* %65, i8* %68, i32 3)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %80
71: ; preds = %44
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 1
%74 = load i8*, i8** %73
%75 = load i64, i64* %6
%76 = call i64 @lib_sort(i8* %74, i64 %75)
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %71
br label %167
79: ; preds = %71
br label %97
80: ; preds = %44
%81 = load i8*, i8** %8
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 3
%84 = load i8*, i8** %83
%85 = call i64 @strncmp(i8* %81, i8* %84, i32 3)
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %96
87: ; preds = %80
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 1
%90 = load i8*, i8** %89
%91 = load i64, i64* %6
%92 = call i64 @sys_sort(i8* %90, i64 %91)
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %95
94: ; preds = %87
br label %167
95: ; preds = %87
br label %96
96: ; preds = %95, %80
br label %97
97: ; preds = %96, %79
%98 = call i64 (...) @clock()
store i64 %98, i64* %13
%99 = load i32, i32* @RUSAGE_SELF
%100 = call i32 @getrusage(i32 %99, %struct.rusage* %9)
%101 = icmp eq i32 %100, -1
br i1 %101, label %102, label %103
102: ; preds = %97
br label %167
103: ; preds = %97
%104 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 1
%105 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %104, i32 0, i32 1
%106 = load i64, i64* %105
%107 = sitofp i64 %106 to double
%108 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 1
%109 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %108, i32 0, i32 0
%110 = load i64, i64* %109
%111 = sitofp i64 %110 to double
%112 = fdiv double %111, 1.000000e+03
%113 = call double @llvm.fmuladd.f64(double %107, double 1.000000e+03, double %112)
store double %113, double* %14
%114 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 0
%115 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %114, i32 0, i32 1
%116 = load i64, i64* %115
%117 = sitofp i64 %116 to double
%118 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 0
%119 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %118, i32 0, i32 0
%120 = load i64, i64* %119
%121 = sitofp i64 %120 to double
%122 = fdiv double %121, 1.000000e+03
%123 = call double @llvm.fmuladd.f64(double %117, double 1.000000e+03, double %122)
store double %123, double* %15
%124 = load i64, i64* %13
%125 = load i64, i64* %10
%126 = sub nsw i64 %124, %125
%127 = sitofp i64 %126 to double
%128 = load i64, i64* @CLOCKS_PER_SEC
%129 = sitofp i64 %128 to double
%130 = fdiv double %129, 1.000000e+03
%131 = fdiv double %127, %130
store double %131, double* %16
%132 = load double, double* %15
%133 = load double, double* %12
%134 = fsub double %132, %133
store double %134, double* %17
%135 = load double, double* %14
%136 = load double, double* %11
%137 = fsub double %135, %136
store double %137, double* %18
%138 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %138, i32** %19
%139 = load i32*, i32** %19
%140 = icmp eq i32* %139, null
br i1 %140, label %141, label %142
141: ; preds = %103
br label %167
142: ; preds = %103
%143 = load i32*, i32** %19
%144 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.6, i64 0, i64 0))
%145 = load i32*, i32** %19
%146 = load i8**, i8*** %5
%147 = getelementptr inbounds i8*, i8** %146, i64 1
%148 = load i8*, i8** %147
%149 = load i8**, i8*** %5
%150 = getelementptr inbounds i8*, i8** %149, i64 2
%151 = load i8*, i8** %150
%152 = load i8**, i8*** %5
%153 = getelementptr inbounds i8*, i8** %152, i64 3
%154 = load i8*, i8** %153
%155 = call i32 (i32*, i8*, ...) @fprintf(i32* %145, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8* %148, i8* %151, i8* %154)
%156 = load i32*, i32** %19
%157 = call i32 (i32*, i8*, ...) @fprintf(i32* %156, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.7, i64 0, i64 0))
%158 = load i32*, i32** %19
%159 = load double, double* %16
%160 = load double, double* %17
%161 = load double, double* %18
%162 = call i32 (i32*, i8*, ...) @fprintf(i32* %158, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.8, i64 0, i64 0), double %159, double %160, double %161)
%163 = load i32*, i32** %19
%164 = call i32 (i32*, i8*, ...) @fprintf(i32* %163, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.9, i64 0, i64 0))
%165 = load i32*, i32** %19
%166 = call i32 @fclose(i32* %165)
store i32 0, i32* %3
br label %170
167: ; preds = %141, %102, %94, %78, %43
%168 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%169 = call i32 @exit(i32 1)
unreachable
170: ; preds = %142, %22
%171 = load i32, i32* %3
ret i32 %171
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@.str.1 = [53 x i8] c"Args:\0A- Filename: %s\0A- Record's size: %s\0A- Type: %s\0A\00"
@.str.2 = [4 x i8] c"lib\00"
@.str.3 = [4 x i8] c"sys\00"
@RUSAGE_SELF = global i32 0
@CLOCKS_PER_SEC = global i64 0
@.str.4 = [11 x i8] c"wyniki.txt\00"
@.str.5 = [3 x i8] c"a+\00"
@.str.6 = [151 x i8] c"\0A\0A-------------------------------------------------------------------------\0A-------------------------------------------------------------------------\0A\00"
@.str.7 = [77 x i8] c"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\0A\00"
@.str.8 = [53 x i8] c"Times: \0A- real: %lf ms\0A- user: %lf ms\0A- sys: %lf ms\0A\00"
@.str.9 = [75 x i8] c"-------------------------------------------------------------------------\0A\00"
@.str.10 = [8 x i8] c"Error: \00"
@str = [26 x i8] c"Wrong number of arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.rusage
%4 = icmp eq i32 %0, 4
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %95
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %11, i8* %13)
%15 = load i8*, i8** %10
%16 = tail call i64 @atol(i8* %15)
%17 = bitcast %struct.rusage* %3 to i8*
%18 = tail call i64 (...) @clock()
%19 = load i32, i32* @RUSAGE_SELF
%20 = call i32 @getrusage(i32 %19, %struct.rusage* %3)
%21 = icmp eq i32 %20, -1
br i1 %21, label %92, label %22
22: ; preds = %7
%23 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 1, i32 1
%24 = load i64, i64* %23
%25 = sitofp i64 %24 to double
%26 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 1, i32 0
%27 = load i64, i64* %26
%28 = sitofp i64 %27 to double
%29 = fdiv double %28, 1.000000e+03
%30 = call double @llvm.fmuladd.f64(double %25, double 1.000000e+03, double %29)
%31 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 0, i32 1
%32 = load i64, i64* %31
%33 = sitofp i64 %32 to double
%34 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 0, i32 0
%35 = load i64, i64* %34
%36 = sitofp i64 %35 to double
%37 = fdiv double %36, 1.000000e+03
%38 = call double @llvm.fmuladd.f64(double %33, double 1.000000e+03, double %37)
%39 = load i8*, i8** %12
%40 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %39, i32 3)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %22
%43 = load i8*, i8** %8
%44 = call i64 @lib_sort(i8* %43, i64 %16)
%45 = icmp eq i64 %44, 0
br i1 %45, label %54, label %92
46: ; preds = %22
%47 = load i8*, i8** %12
%48 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %47, i32 3)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = load i8*, i8** %8
%52 = call i64 @sys_sort(i8* %51, i64 %16)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %92
54: ; preds = %46, %50, %42
%55 = call i64 (...) @clock()
%56 = load i32, i32* @RUSAGE_SELF
%57 = call i32 @getrusage(i32 %56, %struct.rusage* %3)
%58 = icmp eq i32 %57, -1
br i1 %58, label %92, label %59
59: ; preds = %54
%60 = load i64, i64* %23
%61 = load i64, i64* %26
%62 = load i64, i64* %31
%63 = load i64, i64* %34
%64 = load i64, i64* @CLOCKS_PER_SEC
%65 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%66 = icmp eq i32* %65, null
br i1 %66, label %92, label %67
67: ; preds = %59
%68 = sitofp i64 %60 to double
%69 = sitofp i64 %61 to double
%70 = fdiv double %69, 1.000000e+03
%71 = call double @llvm.fmuladd.f64(double %68, double 1.000000e+03, double %70)
%72 = fsub double %71, %30
%73 = sitofp i64 %62 to double
%74 = sitofp i64 %63 to double
%75 = fdiv double %74, 1.000000e+03
%76 = call double @llvm.fmuladd.f64(double %73, double 1.000000e+03, double %75)
%77 = fsub double %76, %38
%78 = sub nsw i64 %55, %18
%79 = sitofp i64 %78 to double
%80 = sitofp i64 %64 to double
%81 = fdiv double %80, 1.000000e+03
%82 = fdiv double %79, %81
%83 = call i64 @fwrite(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.6, i64 0, i64 0), i64 150, i64 1, i32* %65)
%84 = load i8*, i8** %8
%85 = load i8*, i8** %10
%86 = load i8*, i8** %12
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8* %84, i8* %85, i8* %86)
%88 = call i64 @fwrite(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.7, i64 0, i64 0), i64 76, i64 1, i32* %65)
%89 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.8, i64 0, i64 0), double %82, double %77, double %72)
%90 = call i64 @fwrite(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.9, i64 0, i64 0), i64 74, i64 1, i32* %65)
%91 = call i32 @fclose(i32* %65)
br label %95
92: ; preds = %59, %54, %50, %42, %7
%93 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %67, %5
ret i32 0
}