#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 */

/* Variables and functions */
int czytanie(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sortuj_spis(int);
int /*<<< orphan*/ utworz_spis(char *, int);
int main(int arg_num, char *arg[]) {
  int ile;
  if (arg_num == 3) {
    ile = czytanie(arg[1]);
    if (ile > 0) {
      utworz_spis(arg[1], ile);
      sortuj_spis(ile);
    }
    printf("%i", ile);
  } else
    printf("\n Niepoprawne wywolanie: './porzadkuj baza_danych.txt "
           "posortowane.txt'\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11a8 <main+0x68>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <czytanie@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1192 <main+0x52>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1030 <utworz_spis@plt>
mov    -0x14(%rbp),%edi
call   1040 <sortuj_spis@plt>
mov    -0x14(%rbp),%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11b6 <main+0x76>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    118f <main+0x3f>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   1070 <czytanie@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    117d <main+0x2d>
mov    0x8(%r14),%rdi
mov    %ebx,%esi
call   1030 <utworz_spis@plt>
mov    %ebx,%edi
call   1050 <sortuj_spis@plt>
lea    0xe7c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    119b <main+0x4b>
lea    0xe6d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [73 x i8] c"\0A Niepoprawne wywolanie: './porzadkuj baza_danych.txt posortowane.txt'\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %27
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @czytanie(i8* %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %9
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = load i32, i32* %6
%21 = call i32 @utworz_spis(i8* %19, i32 %20)
%22 = load i32, i32* %6
%23 = call i32 @sortuj_spis(i32 %22)
br label %24
24: ; preds = %16, %9
%25 = load i32, i32* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %29
27: ; preds = %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@str = [72 x i8] c"\0A Niepoprawne wywolanie: './porzadkuj baza_danych.txt posortowane.txt'\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @czytanie(i8* %6)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = tail call i32 @utworz_spis(i8* %10, i32 %7)
%12 = tail call i32 @sortuj_spis(i32 %7)
br label %13
13: ; preds = %9, %4
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %17
15: ; preds = %2
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
ret i32 0
}