#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt_long(int, char **, char const *const, struct option const *,
                int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
void manejarArgumentosEntrada(int argc, char **argv) {
  int siguiente_opcion;
  const char *const op_cortas = "hV";
  const struct option op_largas[] = {
      {"help", 0, NULL, 'h'}, {"version", 0, NULL, 'V'}, {NULL, 0, NULL, 0}};
  while (1) {
    siguiente_opcion = getopt_long(argc, argv, op_cortas, op_largas, NULL);
    if (siguiente_opcion == -1)
      break;
    switch (siguiente_opcion) {
    case 'h':
      printf("Usage:\n");
      printf("\ttp0 -h\n");
      printf("\ttp0 -V\n");
      printf("\ttp0 < in_file > out_file\n");
      printf("Options:\n");
      printf("\t-V, --version       Print version and quit.\n");
      printf("\t-h, --help          Print this information and quit.\n");
      printf("Examples:\n");
      printf("\ttp0 < in.txt > out.txt\n");
      printf("\tcat in.txt | tp0 > out.txt\n");
      exit(0);
      break;
    case 'V':
      printf("Tp0:Version_0.1:Grupo:\n");
      exit(0);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<manejarArgumentosEntrada>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea7(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x60,%edx
call   1050 <memset@plt>
lea    0xe8f(%rip),%rax
mov    %rax,-0x80(%rbp)
movl   $0x68,-0x68(%rbp)
lea    0xe82(%rip),%rax
mov    %rax,-0x60(%rbp)
movl   $0x56,-0x48(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x80(%rbp),%rcx
lea    0xe5d(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    11bf <manejarArgumentosEntrada+0x7f>
jmp    1281 <manejarArgumentosEntrada+0x141>
mov    -0x14(%rbp),%eax
mov    %eax,-0x84(%rbp)
sub    $0x56,%eax
je     1269 <manejarArgumentosEntrada+0x129>
jmp    11d6 <manejarArgumentosEntrada+0x96>
mov    -0x84(%rbp),%eax
sub    $0x68,%eax
jne    127c <manejarArgumentosEntrada+0x13c>
jmp    11ea <manejarArgumentosEntrada+0xaa>
lea    0xe1f(%rip),%rdi
call   1040 <printf@plt>
lea    0xe1b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
lea    0xe15(%rip),%rdi
call   1040 <printf@plt>
lea    0xe24(%rip),%rdi
call   1040 <printf@plt>
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
jmp    1191 <manejarArgumentosEntrada+0x51>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manejarArgumentosEntrada>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
lea    0xe9d(%rip),%rax
mov    %rax,(%rsp)
movl   $0x68,0x18(%rsp)
lea    0xe8f(%rip),%rax
mov    %rax,0x20(%rsp)
movl   $0x56,0x38(%rsp)
lea    0xe73(%rip),%r14
mov    %rsp,%r15
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
cmp    $0xffffffff,%eax
je     122f <manejarArgumentosEntrada+0xff>
cmp    $0x56,%eax
je     123a <manejarArgumentosEntrada+0x10a>
cmp    $0x68,%eax
jne    1190 <manejarArgumentosEntrada+0x60>
lea    0xe66(%rip),%rdi
call   1030 <puts@plt>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
lea    0xe67(%rip),%rdi
call   1030 <puts@plt>
lea    0xe64(%rip),%rdi
call   1030 <puts@plt>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
jmp    1241 <manejarArgumentosEntrada+0x111>
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdcf(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [3 x i8] c"hV\00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [8 x i8] c"version\00"
@.str.3 = [8 x i8] c"Usage:\0A\00"
@.str.4 = [9 x i8] c"\09tp0 -h\0A\00"
@.str.5 = [9 x i8] c"\09tp0 -V\0A\00"
@.str.6 = [27 x i8] c"\09tp0 < in_file > out_file\0A\00"
@.str.7 = [10 x i8] c"Options:\0A\00"
@.str.8 = [46 x i8] c"\09-V, --version Print version and quit.\0A\00"
@.str.9 = [55 x i8] c"\09-h, --help Print this information and quit.\0A\00"
@.str.10 = [11 x i8] c"Examples:\0A\00"
@.str.11 = [25 x i8] c"\09tp0 < in.txt > out.txt\0A\00"
@.str.12 = [29 x i8] c"\09cat in.txt | tp0 > out.txt\0A\00"
@.str.13 = [24 x i8] c"Tp0:Version_0.1:Grupo:\0A\00"
define void @manejarArgumentosEntrada(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [3 x %struct.option]
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %6
%8 = bitcast [3 x %struct.option]* %7 to i8*
%9 = bitcast i8* %8 to [3 x %struct.option]*
%10 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %9, i32 0, i32 0
%11 = getelementptr inbounds %struct.option, %struct.option* %10, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds %struct.option, %struct.option* %10, i32 0, i32 3
store i32 104, i32* %12
%13 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %9, i32 0, i32 1
%14 = getelementptr inbounds %struct.option, %struct.option* %13, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds %struct.option, %struct.option* %13, i32 0, i32 3
store i32 86, i32* %15
br label %16
16: ; preds = %2, %41
%17 = load i32, i32* %3
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %7, i64 0, i64 0
%20 = call i32 @getopt_long(i32 %17, i8** %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), %struct.option* %19, i32* null)
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %24
23: ; preds = %16
br label %42
24: ; preds = %16
%25 = load i32, i32* %5
switch i32 %25, label %41 [
i32 104, label %26
i32 86, label %38
]
26: ; preds = %24
%27 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.9, i64 0, i64 0))
%34 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%35 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%36 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0))
%37 = call i32 @exit(i32 0)
unreachable
38: ; preds = %24
%39 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%40 = call i32 @exit(i32 0)
unreachable
41: ; preds = %24
br label %16
42: ; preds = %23
ret void
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [3 x i8] c"hV\00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [8 x i8] c"version\00"
@str = [23 x i8] c"Tp0:Version_0.1:Grupo:\00"
@str.14 = [7 x i8] c"Usage:\00"
@str.15 = [8 x i8] c"\09tp0 -h\00"
@str.16 = [8 x i8] c"\09tp0 -V\00"
@str.17 = [26 x i8] c"\09tp0 < in_file > out_file\00"
@str.18 = [9 x i8] c"Options:\00"
@str.19 = [45 x i8] c"\09-V, --version Print version and quit.\00"
@str.20 = [54 x i8] c"\09-h, --help Print this information and quit.\00"
@str.21 = [10 x i8] c"Examples:\00"
@str.22 = [24 x i8] c"\09tp0 < in.txt > out.txt\00"
@str.23 = [28 x i8] c"\09cat in.txt | tp0 > out.txt\00"
define void @manejarArgumentosEntrada(i32 %0, i8** %1) {
%3 = alloca [3 x %struct.option]
%4 = bitcast [3 x %struct.option]* %3 to i8*
%5 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 3
store i32 104, i32* %6
%7 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 3
store i32 86, i32* %8
%9 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0
br label %10
10: ; preds = %10, %2
%11 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.option* %9, i32* null)
switch i32 %11, label %10 [
i32 -1, label %27
i32 104, label %12
i32 86, label %24
]
12: ; preds = %10
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.14, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.15, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.16, i64 0, i64 0))
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.17, i64 0, i64 0))
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.18, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.19, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.20, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.21, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.22, i64 0, i64 0))
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.23, i64 0, i64 0))
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %10
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %10
ret void
}