#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ radix(int *, int);
int main() {
  int x;
  int vetor[101];
  FILE *arq;
  int range;
  arq = fopen("couting.txt", "r");
  int i = 0;
  while (!feof(arq)) {
    fscanf(arq, "%d", &x);
    vetor[i] = x;
    i++;
  }
  fclose(arq);
  radix(vetor, 101);
  for (i = 0; i < 101; i++) {
    printf("%d\n", vetor[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
lea    0xe8c(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x1a8(%rbp)
movl   $0x0,-0x1b0(%rbp)
mov    -0x1a8(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11b7 <main+0x57>
jmp    11f3 <main+0x93>
mov    -0x1a8(%rbp),%rdi
lea    0xe49(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x8(%rbp),%ecx
movslq -0x1b0(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x1b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b0(%rbp)
jmp    1196 <main+0x36>
mov    -0x1a8(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0x65,%esi
call   1070 <radix@plt>
movl   $0x0,-0x1b0(%rbp)
cmpl   $0x65,-0x1b0(%rbp)
jge    1255 <main+0xf5>
movslq -0x1b0(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xdd5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b0(%rbp)
jmp    121a <main+0xba>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0xe8b(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    11d4 <main+0x74>
lea    0x10(%rsp),%rbx
lea    0xe72(%rip),%r14
lea    0xc(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
mov    %r12,%rdi
call   1060 <feof@plt>
add    $0x4,%rbx
test   %eax,%eax
je     11b0 <main+0x50>
mov    %r12,%rdi
call   1030 <fclose@plt>
lea    0x10(%rsp),%rdi
mov    $0x65,%esi
call   1070 <radix@plt>
xor    %ebx,%ebx
lea    0xe1d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    1200 <main+0xa0>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"couting.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [101 x i32]
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %4
store i32 0, i32* %6
br label %8
8: ; preds = %13, %0
%9 = load i32*, i32** %4
%10 = call i32 @feof(i32* %9)
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %22
13: ; preds = %8
%14 = load i32*, i32** %4
%15 = call i32 @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%16 = load i32, i32* %2
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [101 x i32], [101 x i32]* %3, i64 0, i64 %18
store i32 %16, i32* %19
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %8
22: ; preds = %8
%23 = load i32*, i32** %4
%24 = call i32 @fclose(i32* %23)
%25 = getelementptr inbounds [101 x i32], [101 x i32]* %3, i64 0, i64 0
%26 = call i32 @radix(i32* %25, i32 101)
store i32 0, i32* %6
br label %27
27: ; preds = %36, %22
%28 = load i32, i32* %6
%29 = icmp slt i32 %28, 101
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [101 x i32], [101 x i32]* %3, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %30
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %27
39: ; preds = %27
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [12 x i8] c"couting.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [101 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [101 x i32]* %2 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @feof(i32* %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %0, %8
%9 = phi i64 [ %13, %8 ], [ 0, %0 ]
%10 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = getelementptr inbounds [101 x i32], [101 x i32]* %2, i64 0, i64 %9
store i32 %11, i32* %12
%13 = add nuw i64 %9, 1
%14 = call i32 @feof(i32* %5)
%15 = icmp eq i32 %14, 0
br i1 %15, label %8, label %16
16: ; preds = %8, %0
%17 = call i32 @fclose(i32* %5)
%18 = getelementptr inbounds [101 x i32], [101 x i32]* %2, i64 0, i64 0
%19 = call i32 @radix(i32* %18, i32 101)
br label %20
20: ; preds = %16, %20
%21 = phi i64 [ 0, %16 ], [ %25, %20 ]
%22 = getelementptr inbounds [101 x i32], [101 x i32]* %2, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i64 %21, 1
%26 = icmp eq i64 %25, 101
br i1 %26, label %27, label %20
27: ; preds = %20
ret i32 0
}