#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ memset(char *, char, int);
int ordena_vector(char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
char *procesar_linea(char *linea, int num_linea) {
  int tam_vector;
  if (strlen(linea) < (9 + 1) + ((23) * (6)) * 6) {
    fprintf(stderr, "ERROR LARGO DE LINEA en linea %d\n", num_linea);
    return linea;
  }
  tam_vector = ordena_vector(linea + 9);
  if (tam_vector == 0) {
    linea[9] = 'N';
    memset(linea + 9 + 1, ' ', (23) * (6));
  } else if (tam_vector > 23) {
    linea[9] = 'S';
    memset(linea + 9 + 1, ' ', (23) * (6));
  } else {
    linea[9] = 'D';
    memset(linea + (9 + tam_vector * 6 + 1), ' ', (23) * (6) - tam_vector * 6);
  }
  linea[9 + (23) * (6) + 1] = '\n';
  linea[9 + (23) * (6) + 2] = '\0';
  return linea;
}


x86 assembly (clang, -O0):
<procesar_linea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x346,%eax
jge    1188 <procesar_linea+0x48>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe8a(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    124f <procesar_linea+0x10f>
mov    -0x10(%rbp),%rdi
add    $0x9,%rdi
call   1060 <ordena_vector@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11ca <procesar_linea+0x8a>
mov    -0x10(%rbp),%rax
movb   $0x4e,0x9(%rax)
mov    -0x10(%rbp),%rdi
add    $0x9,%rdi
add    $0x1,%rdi
mov    $0x20,%esi
mov    $0x8a,%edx
call   1040 <memset@plt>
jmp    1231 <procesar_linea+0xf1>
cmpl   $0x17,-0x18(%rbp)
jle    11fc <procesar_linea+0xbc>
mov    -0x10(%rbp),%rax
movb   $0x53,0x9(%rax)
mov    -0x10(%rbp),%rdi
add    $0x9,%rdi
add    $0x1,%rdi
mov    $0x20,%esi
mov    $0x8a,%edx
call   1040 <memset@plt>
jmp    122c <procesar_linea+0xec>
mov    -0x10(%rbp),%rax
movb   $0x44,0x9(%rax)
mov    -0x10(%rbp),%rdi
imul   $0x6,-0x18(%rbp),%eax
add    $0x9,%eax
add    $0x1,%eax
cltq
add    %rax,%rdi
imul   $0x6,-0x18(%rbp),%eax
mov    $0x8a,%edx
sub    %eax,%edx
mov    $0x20,%esi
call   1040 <memset@plt>
jmp    1231 <procesar_linea+0xf1>
mov    -0x10(%rbp),%rax
movb   $0xa,0x94(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x95(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<procesar_linea>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x345,%eax
jg     116d <procesar_linea+0x2d>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
mov    %ebp,%edx
call   1050 <fprintf@plt>
jmp    11c6 <procesar_linea+0x86>
lea    0x9(%rbx),%rdi
call   1060 <ordena_vector@plt>
test   %eax,%eax
je     1185 <procesar_linea+0x45>
cmp    $0x18,%eax
jl     1199 <procesar_linea+0x59>
movb   $0x53,0x9(%rbx)
jmp    1189 <procesar_linea+0x49>
movb   $0x4e,0x9(%rbx)
lea    0xa(%rbx),%rdi
mov    $0x20,%esi
mov    $0x8a,%edx
jmp    11b8 <procesar_linea+0x78>
movb   $0x44,0x9(%rbx)
add    %eax,%eax
lea    (%rax,%rax,2),%eax
cltq
lea    (%rax,%rbx,1),%rdi
add    $0xa,%rdi
mov    $0x8a,%edx
sub    %eax,%edx
mov    $0x20,%esi
call   1040 <memset@plt>
movw   $0xa,0x94(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"ERROR LARGO DE LINEA en linea %d\0A\00"
define i8* @procesar_linea(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = icmp slt i32 %8, 838
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i32, i32* %5
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i8*, i8** %4
store i8* %14, i8** %3
br label %59
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 9
%18 = call i32 @ordena_vector(i8* %17)
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %15
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 9
store i8 78, i8* %23
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 9
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = call i32 @memset(i8* %26, i8 signext 32, i32 138)
br label %53
28: ; preds = %15
%29 = load i32, i32* %6
%30 = icmp sgt i32 %29, 23
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i64 9
store i8 83, i8* %33
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i64 9
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = call i32 @memset(i8* %36, i8 signext 32, i32 138)
br label %52
38: ; preds = %28
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i64 9
store i8 68, i8* %40
%41 = load i8*, i8** %4
%42 = load i32, i32* %6
%43 = mul nsw i32 %42, 6
%44 = add nsw i32 9, %43
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %41, i64 %46
%48 = load i32, i32* %6
%49 = mul nsw i32 %48, 6
%50 = sub nsw i32 138, %49
%51 = call i32 @memset(i8* %47, i8 signext 32, i32 %50)
br label %52
52: ; preds = %38, %31
br label %53
53: ; preds = %52, %21
%54 = load i8*, i8** %4
%55 = getelementptr inbounds i8, i8* %54, i64 148
store i8 10, i8* %55
%56 = load i8*, i8** %4
%57 = getelementptr inbounds i8, i8* %56, i64 149
store i8 0, i8* %57
%58 = load i8*, i8** %4
store i8* %58, i8** %3
br label %59
59: ; preds = %53, %10
%60 = load i8*, i8** %3
ret i8* %60
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"ERROR LARGO DE LINEA en linea %d\0A\00"
define i8* @procesar_linea(i8* returned %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp slt i32 %3, 838
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %30
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %0, i64 9
%10 = tail call i32 @ordena_vector(i8* %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
store i8 78, i8* %9
%13 = getelementptr inbounds i8, i8* %0, i64 10
%14 = tail call i32 @memset(i8* %13, i8 signext 32, i32 138)
br label %27
15: ; preds = %8
%16 = icmp sgt i32 %10, 23
br i1 %16, label %17, label %20
17: ; preds = %15
store i8 83, i8* %9
%18 = getelementptr inbounds i8, i8* %0, i64 10
%19 = tail call i32 @memset(i8* %18, i8 signext 32, i32 138)
br label %27
20: ; preds = %15
store i8 68, i8* %9
%21 = mul nsw i32 %10, 6
%22 = add nsw i32 %21, 10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %0, i64 %23
%25 = sub nsw i32 138, %21
%26 = tail call i32 @memset(i8* %24, i8 signext 32, i32 %25)
br label %27
27: ; preds = %17, %20, %12
%28 = getelementptr inbounds i8, i8* %0, i64 148
store i8 10, i8* %28
%29 = getelementptr inbounds i8, i8* %0, i64 149
store i8 0, i8* %29
br label %30
30: ; preds = %27, %5
ret i8* %0
}