#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*/ automataFromCadena(char *, int *);
int /*<<< orphan*/ automataFromFichero(char *, int *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
main(int argc, char **argv) {
  int posicion = 0;
  if (argv[1] == NULL)
    fprintf(stderr, "No hay argumentos\n");
  else {
    if (strcmp(argv[1], "--cadena") == 0)
      automataFromCadena(argv[2], &posicion);
    else if (strcmp(argv[1], "--archivo") == 0)
      automataFromFichero(argv[2], &posicion);
    else
      fprintf(stderr, "Argumento invalido\n");
  }
  return 0;
}


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)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    1186 <main+0x46>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1040 <fprintf@plt>
jmp    120d <main+0xcd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11ba <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <automataFromCadena@plt>
jmp    1208 <main+0xc8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe53(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11ee <main+0xae>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <automataFromFichero@plt>
jmp    1203 <main+0xc3>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
lea    0xe28(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1208 <main+0xc8>
jmp    120d <main+0xcd>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     1191 <main+0x51>
mov    %rsi,%rbx
lea    0xeb3(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a8 <main+0x68>
mov    0x8(%rbx),%rdi
lea    0xea7(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b8 <main+0x78>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
jmp    11a1 <main+0x61>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xe5f(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11c6 <main+0x86>
mov    0x10(%rbx),%rdi
lea    0xc(%rsp),%rsi
call   1050 <automataFromCadena@plt>
jmp    11c6 <main+0x86>
mov    0x10(%rbx),%rdi
lea    0xc(%rsp),%rsi
call   1060 <automataFromFichero@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"No hay argumentos\0A\00"
@.str.1 = [9 x i8] c"--cadena\00"
@.str.2 = [10 x i8] c"--archivo\00"
@.str.3 = [20 x i8] c"Argumento invalido\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
store i32 0, i32* %6
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %41
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %14
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @automataFromCadena(i8* %23, i32* %6)
br label %40
25: ; preds = %14
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %25
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i32 @automataFromFichero(i8* %34, i32* %6)
br label %39
36: ; preds = %25
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %36, %31
br label %40
40: ; preds = %39, %20
br label %41
41: ; preds = %40, %11
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"No hay argumentos\0A\00"
@.str.1 = [9 x i8] c"--cadena\00"
@.str.2 = [10 x i8] c"--archivo\00"
@.str.3 = [20 x i8] c"Argumento invalido\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %29
11: ; preds = %2
%12 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @automataFromCadena(i8* %16, i32* %3)
br label %29
18: ; preds = %11
%19 = load i8*, i8** %5
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @automataFromFichero(i8* %24, i32* %3)
br label %29
26: ; preds = %18
%27 = load i32, i32* @stderr
%28 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %14, %26, %22, %8
ret i32 0
}