#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ print_arr(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_arr(int /*<<< orphan*/ *, int *, int *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ sort_odd(int *, int);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  setbuf(stdout, NULL);
  int arr[20];
  int size;
  FILE *f1, *f2;
  if (argc != 3) {
    printf("Incorrect number of arguments\n");
    return -3;
  }
  f1 = fopen(argv[1], "r");
  f2 = fopen(argv[2], "w");
  if ((f1 == NULL) || (f2 == NULL)) {
    printf("Can't open files\n");
    return -1;
  }
  read_arr(f1, arr, &size);
  print_arr(arr, size);
  printf("\n");
  sort_odd(arr, size);
  print_arr(arr, size);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
cmpl   $0x3,-0x8(%rbp)
je     11ad <main+0x4d>
lea    0xe64(%rip),%rdi
call   1050 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1253 <main+0xf3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe63(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe4d(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x70(%rbp)
je     11f3 <main+0x93>
cmpq   $0x0,-0x78(%rbp)
jne    120b <main+0xab>
lea    0xe29(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1253 <main+0xf3>
mov    -0x70(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x64(%rbp),%rdx
call   1060 <read_arr@plt>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1030 <print_arr@plt>
lea    0xe04(%rip),%rdi
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1080 <sort_odd@plt>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1030 <print_arr@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1060 <setbuf@plt>
cmp    $0x3,%ebp
jne    1206 <main+0x96>
mov    0x8(%rbx),%rdi
lea    0xe63(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe52(%rip),%rsi
call   1080 <fopen@plt>
test   %r14,%r14
je     1219 <main+0xa9>
test   %rax,%rax
je     1219 <main+0xa9>
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <read_arr@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <print_arr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1090 <sort_odd@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <print_arr@plt>
xor    %eax,%eax
jmp    122a <main+0xba>
lea    0xe08(%rip),%rdi
call   1040 <puts@plt>
mov    $0xfffffffd,%eax
jmp    122a <main+0xba>
lea    0xde4(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [31 x i8] c"Incorrect number of arguments\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [18 x i8] c"Can't open files\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i32]
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* @stdout
%11 = call i32 @setbuf(i32 %10, i32* null)
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 -3, i32* %3
br label %46
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %8
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %24, i32** %9
%25 = load i32*, i32** %8
%26 = icmp eq i32* %25, null
br i1 %26, label %30, label %27
27: ; preds = %16
%28 = load i32*, i32** %9
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %32
30: ; preds = %27, %16
%31 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %46
32: ; preds = %27
%33 = load i32*, i32** %8
%34 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%35 = call i32 @read_arr(i32* %33, i32* %34, i32* %7)
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%37 = load i32, i32* %7
%38 = call i32 @print_arr(i32* %36, i32 %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%41 = load i32, i32* %7
%42 = call i32 @sort_odd(i32* %40, i32 %41)
%43 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%44 = load i32, i32* %7
%45 = call i32 @print_arr(i32* %43, i32 %44)
store i32 0, i32* %3
br label %46
46: ; preds = %32, %30, %14
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@stdout = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@str = [17 x i8] c"Can't open files\00"
@str.5 = [30 x i8] c"Incorrect number of arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [20 x i32]
%4 = alloca i32
%5 = load i32, i32* @stdout
%6 = tail call i32 @setbuf(i32 %5, i32* null)
%7 = bitcast [20 x i32]* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = icmp eq i32 %0, 3
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.5, i64 0, i64 0))
br label %34
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i32* %15, null
%20 = icmp eq i32* %18, null
%21 = or i1 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %12
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %34
24: ; preds = %12
%25 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%26 = call i32 @read_arr(i32* %15, i32* %25, i32* %4)
%27 = load i32, i32* %4
%28 = call i32 @print_arr(i32* %25, i32 %27)
%29 = call i32 @putchar(i32 10)
%30 = load i32, i32* %4
%31 = call i32 @sort_odd(i32* %25, i32 %30)
%32 = load i32, i32* %4
%33 = call i32 @print_arr(i32* %25, i32 %32)
br label %34
34: ; preds = %24, %22, %10
%35 = phi i32 [ -3, %10 ], [ -1, %22 ], [ 0, %24 ]
ret i32 %35
}