#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ gets(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int /*<<< orphan*/ system(char *);
void openFile(int ***matrizTransicao, int **estadoFinal, int *nEstados,
              int *estadoInicial, int *nEstadosFinais) {
  FILE *arquivo = NULL;
  int **transicao = NULL;
  int *finais = NULL;
  int i, j, k, x, fim;
  char y;
  char arqName[50];
  char alfabeto[50];
  printf("\n\n\nDigite o nome do arquivouivo (.txt) com a transicao: \n");
  gets(arqName);
  arquivo = fopen(arqName, "r");
  if (arquivo == NULL) {
    printf("\n\nERROR: Nao foi possivel ler o arquivouivo"
           "\n\nVerifique se o nome e/ou caminho estao corretos"
           "\nA extensao do arquivouivo deve ser .txt\n\n");
    system("Pause");
    exit(1);
  }
  fscanf(arquivo, "%s", alfabeto);
  fscanf(arquivo, "%i", estadoInicial);
  fscanf(arquivo, "%i", nEstados);
  fscanf(arquivo, "%i", nEstadosFinais);
  printf("\nAlfabeto:                  %s", alfabeto);
  printf("\nEstado Inicial:            Q%i", *estadoInicial);
  printf("\nNumero de Estados:         %i", *nEstados);
  printf("\nNumero de Estados Finiais: %i\n", *nEstadosFinais);
  transicao = (int **)malloc((*nEstados) * sizeof(int *));
  if (transicao == NULL) {
    printf("\n\nERROR: Nao foi possivel alocar a transicao na matrizriz\n");
    system("Pause");
    exit(1);
  }
  for (i = 0; i < (*nEstados); i++) {
    transicao[i] = (int *)malloc(strlen(alfabeto) * sizeof(int));
    if (transicao[i] == NULL)
      exit(1);
  }
  finais = (int *)malloc((*nEstadosFinais) * sizeof(int));
  if (finais == NULL) {
    printf("\n\nERROR: Nao foi possivel alocar o vetor de estados finais\n");
    system("Pause");
    exit(1);
  }
  for (k = 0; k < (*nEstadosFinais); k++) {
    fscanf(arquivo, "%i", &fim);
    finais[fim] = fim;
    printf("\nEstado Final = Q%i\t", finais[fim]);
  }
  printf("\n\nFuncao de Transicao do A.F.D\n\n");
  printf("-------------------------\n");
  for (i = 0; i < (*nEstados); i++) {
    for (j = 0; j < strlen(alfabeto); j++) {
      fscanf(arquivo, "%i %c %i", &x, &y, &transicao[i][j]);
      printf("|  Q%i  |   %c   |   Q%i   |\n", x, y, transicao[i][j]);
      printf("-------------------------\n");
    }
  }
  (*matrizTransicao) = transicao;
  (*estadoFinal) = finais;
  fclose(arquivo);
}


x86 assembly (clang, -O0):
<openFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1080 <gets@plt>
lea    -0x90(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1227 <openFile+0x97>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xeab(%rip),%rdi
call   1050 <system@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x30(%rbp),%rdi
lea    -0xd0(%rbp),%rdx
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xed5(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xea9(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
lea    -0xd0(%rbp),%rsi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1318 <openFile+0x188>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdba(%rip),%rdi
call   1050 <system@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1386 <openFile+0x1f6>
lea    -0xd0(%rbp),%rdi
call   1040 <strlen@plt>
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1373 <openFile+0x1e3>
mov    $0x1,%edi
call   10b0 <exit@plt>
jmp    1378 <openFile+0x1e8>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    131f <openFile+0x18f>
mov    -0x28(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    13cb <openFile+0x23b>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd07(%rip),%rdi
call   1050 <system@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    142c <openFile+0x29c>
mov    -0x30(%rbp),%rdi
lea    0xd38(%rip),%rsi
lea    -0x54(%rbp),%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x54(%rbp),%edx
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13d2 <openFile+0x242>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1512 <openFile+0x382>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0xd4(%rbp)
lea    -0xd0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0xd4(%rbp),%eax
cmp    %ecx,%eax
jge    14ff <openFile+0x36f>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%r8
movslq -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%r8
lea    0xd63(%rip),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x55(%rbp),%rcx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x50(%rbp),%esi
movsbl -0x55(%rbp),%edx
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1465 <openFile+0x2d5>
jmp    1504 <openFile+0x374>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    144f <openFile+0x2bf>
mov    -0x38(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x40(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rsi,0x38(%rsp)
mov    %rdi,0x30(%rsp)
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0x80(%rsp),%rbp
mov    %rbp,%rdi
call   1090 <gets@plt>
lea    0xe19(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     14b5 <openFile+0x315>
lea    0xe25(%rip),%rsi
lea    0x40(%rsp),%r14
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
lea    0xe48(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
mov    %rbx,0x10(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
lea    0xdb1(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13),%esi
lea    0xdbb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r12),%esi
lea    0xdc9(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r15),%esi
lea    0xdd7(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r12),%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     14be <openFile+0x31e>
mov    %rax,%rbp
cmpl   $0x0,(%r12)
jle    12ef <openFile+0x14f>
xor    %ebx,%ebx
lea    0x40(%rsp),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x0(,%rax,4),%edi
call   10a0 <malloc@plt>
mov    %rax,0x0(%rbp,%rbx,8)
test   %rax,%rax
je     14ab <openFile+0x30b>
add    $0x1,%rbx
movslq (%r12),%rax
cmp    %rax,%rbx
jl     12c0 <openFile+0x120>
mov    %r12,0x28(%rsp)
mov    (%r15),%edi
shl    $0x2,%edi
call   10a0 <malloc@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     14c7 <openFile+0x327>
mov    %rbp,0x8(%rsp)
cmpl   $0x0,(%r15)
mov    0x10(%rsp),%r13
mov    0x20(%rsp),%r14
jle    1376 <openFile+0x1d6>
lea    0xd3a(%rip),%rbp
lea    0xd56(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %rbp,%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
movslq 0x4(%rsp),%rax
mov    %eax,(%r14,%rax,4)
movslq 0x4(%rsp),%rax
mov    (%r14,%rax,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%ebx
cmp    (%r15),%ebx
jl     1340 <openFile+0x1a0>
lea    0xd7e(%rip),%rdi
call   1030 <puts@plt>
lea    0xd92(%rip),%rdi
call   1030 <puts@plt>
mov    0x28(%rsp),%rax
cmpl   $0x0,(%rax)
jle    1475 <openFile+0x2d5>
lea    0x40(%rsp),%r13
xor    %ebx,%ebx
mov    0x10(%rsp),%r12
jmp    13cd <openFile+0x22d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r9
mov    0x28(%rsp),%rax
movslq (%rax),%rax
cmp    %rax,%r9
lea    0x40(%rsp),%r13
mov    %r9,%rbx
jge    1475 <openFile+0x2d5>
mov    %r13,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
lea    0xcbd(%rip),%rbp
lea    0x1c(%rsp),%rax
mov    %rbx,%r9
mov    %rax,%rbx
lea    0x3(%rsp),%rcx
mov    0x8(%rsp),%rax
jle    13b0 <openFile+0x210>
xor    %r14d,%r14d
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    (%rax,%r9,8),%r8
add    %r14,%r8
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r9,%r13
xor    %eax,%eax
call   1080 <fscanf@plt>
mov    0x1c(%rsp),%esi
movsbl 0x3(%rsp),%edx
mov    0x8(%rsp),%rax
mov    (%rax,%r13,8),%rax
mov    (%rax,%r14,1),%ecx
lea    0xc6d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xcd6(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%r15
lea    0x40(%rsp),%rdi
call   1050 <strlen@plt>
lea    0x3(%rsp),%rcx
mov    %r13,%r9
cltq
add    $0x4,%r14
cmp    %rax,%r15
mov    0x8(%rsp),%rax
jl     1400 <openFile+0x260>
jmp    13b0 <openFile+0x210>
mov    0x30(%rsp),%rax
mov    0x8(%rsp),%rcx
mov    %rcx,(%rax)
mov    0x38(%rsp),%rax
mov    0x20(%rsp),%rcx
mov    %rcx,(%rax)
mov    0x10(%rsp),%rdi
call   1040 <fclose@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0xcee(%rip),%rdi
jmp    14ce <openFile+0x32e>
lea    0xcab(%rip),%rdi
jmp    14ce <openFile+0x32e>
lea    0xc67(%rip),%rdi
call   1030 <puts@plt>
lea    0xb28(%rip),%rdi
call   1060 <system@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [58 x i8] c"\0A\0A\0ADigite o nome do arquivouivo (.txt) com a transicao: \0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [135 x i8] c"\0A\0AERROR: Nao foi possivel ler o arquivouivo\0A\0AVerifique se o nome e/ou caminho estao corretos\0AA extensao do arquivouivo deve ser .txt\0A\0A\00"
@.str.3 = [6 x i8] c"Pause\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [3 x i8] c"%i\00"
@.str.6 = [31 x i8] c"\0AAlfabeto: %s\00"
@.str.7 = [32 x i8] c"\0AEstado Inicial: Q%i\00"
@.str.8 = [31 x i8] c"\0ANumero de Estados: %i\00"
@.str.9 = [32 x i8] c"\0ANumero de Estados Finiais: %i\0A\00"
@.str.10 = [59 x i8] c"\0A\0AERROR: Nao foi possivel alocar a transicao na matrizriz\0A\00"
@.str.11 = [60 x i8] c"\0A\0AERROR: Nao foi possivel alocar o vetor de estados finais\0A\00"
@.str.12 = [21 x i8] c"\0AEstado Final = Q%i\09\00"
@.str.13 = [33 x i8] c"\0A\0AFuncao de Transicao do A.F.D\0A\0A\00"
@.str.14 = [27 x i8] c"-------------------------\0A\00"
@.str.15 = [9 x i8] c"%i %c %i\00"
@.str.16 = [30 x i8] c"| Q%i | %c | Q%i |\0A\00"
define void @openFile(i32*** %0, i32** %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32***
%7 = alloca i32**
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32**
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i8
%20 = alloca [50 x i8]
%21 = alloca [50 x i8]
store i32*** %0, i32**** %6
store i32** %1, i32*** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
store i32* null, i32** %11
store i32** null, i32*** %12
store i32* null, i32** %13
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %20, i64 0, i64 0
%24 = call i32 @gets(i8* %23)
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %20, i64 0, i64 0
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %11
%27 = load i32*, i32** %11
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %33
29: ; preds = %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %5
%34 = load i32*, i32** %11
%35 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%36 = call i32 (i32*, i8*, ...) @fscanf(i32* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %35)
%37 = load i32*, i32** %11
%38 = load i32*, i32** %9
%39 = call i32 (i32*, i8*, ...) @fscanf(i32* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %38)
%40 = load i32*, i32** %11
%41 = load i32*, i32** %8
%42 = call i32 (i32*, i8*, ...) @fscanf(i32* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %41)
%43 = load i32*, i32** %11
%44 = load i32*, i32** %10
%45 = call i32 (i32*, i8*, ...) @fscanf(i32* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %44)
%46 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %46)
%48 = load i32*, i32** %9
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %49)
%51 = load i32*, i32** %8
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %52)
%54 = load i32*, i32** %10
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i32 %55)
%57 = load i32*, i32** %8
%58 = load i32, i32* %57
%59 = sext i32 %58 to i64
%60 = mul i64 %59, 8
%61 = trunc i64 %60 to i32
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to i32**
store i32** %63, i32*** %12
%64 = load i32**, i32*** %12
%65 = icmp eq i32** %64, null
br i1 %65, label %66, label %70
66: ; preds = %33
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.10, i64 0, i64 0))
%68 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %33
store i32 0, i32* %14
br label %71
71: ; preds = %97, %70
%72 = load i32, i32* %14
%73 = load i32*, i32** %8
%74 = load i32, i32* %73
%75 = icmp slt i32 %72, %74
br i1 %75, label %76, label %100
76: ; preds = %71
%77 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%78 = call i32 @strlen(i8* %77)
%79 = sext i32 %78 to i64
%80 = mul i64 %79, 4
%81 = trunc i64 %80 to i32
%82 = call i64 @malloc(i32 %81)
%83 = inttoptr i64 %82 to i32*
%84 = load i32**, i32*** %12
%85 = load i32, i32* %14
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32*, i32** %84, i64 %86
store i32* %83, i32** %87
%88 = load i32**, i32*** %12
%89 = load i32, i32* %14
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32*, i32** %88, i64 %90
%92 = load i32*, i32** %91
%93 = icmp eq i32* %92, null
br i1 %93, label %94, label %96
94: ; preds = %76
%95 = call i32 @exit(i32 1)
unreachable
96: ; preds = %76
br label %97
97: ; preds = %96
%98 = load i32, i32* %14
%99 = add nsw i32 %98, 1
store i32 %99, i32* %14
br label %71
100: ; preds = %71
%101 = load i32*, i32** %10
%102 = load i32, i32* %101
%103 = sext i32 %102 to i64
%104 = mul i64 %103, 4
%105 = trunc i64 %104 to i32
%106 = call i64 @malloc(i32 %105)
%107 = inttoptr i64 %106 to i32*
store i32* %107, i32** %13
%108 = load i32*, i32** %13
%109 = icmp eq i32* %108, null
br i1 %109, label %110, label %114
110: ; preds = %100
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.11, i64 0, i64 0))
%112 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %100
store i32 0, i32* %16
br label %115
115: ; preds = %134, %114
%116 = load i32, i32* %16
%117 = load i32*, i32** %10
%118 = load i32, i32* %117
%119 = icmp slt i32 %116, %118
br i1 %119, label %120, label %137
120: ; preds = %115
%121 = load i32*, i32** %11
%122 = call i32 (i32*, i8*, ...) @fscanf(i32* %121, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %18)
%123 = load i32, i32* %18
%124 = load i32*, i32** %13
%125 = load i32, i32* %18
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i32, i32* %124, i64 %126
store i32 %123, i32* %127
%128 = load i32*, i32** %13
%129 = load i32, i32* %18
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i32, i32* %128, i64 %130
%132 = load i32, i32* %131
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i32 %132)
br label %134
134: ; preds = %120
%135 = load i32, i32* %16
%136 = add nsw i32 %135, 1
store i32 %136, i32* %16
br label %115
137: ; preds = %115
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.13, i64 0, i64 0))
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %14
br label %140
140: ; preds = %180, %137
%141 = load i32, i32* %14
%142 = load i32*, i32** %8
%143 = load i32, i32* %142
%144 = icmp slt i32 %141, %143
br i1 %144, label %145, label %183
145: ; preds = %140
store i32 0, i32* %15
br label %146
146: ; preds = %176, %145
%147 = load i32, i32* %15
%148 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%149 = call i32 @strlen(i8* %148)
%150 = icmp slt i32 %147, %149
br i1 %150, label %151, label %179
151: ; preds = %146
%152 = load i32*, i32** %11
%153 = load i32**, i32*** %12
%154 = load i32, i32* %14
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds i32*, i32** %153, i64 %155
%157 = load i32*, i32** %156
%158 = load i32, i32* %15
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds i32, i32* %157, i64 %159
%161 = call i32 (i32*, i8*, ...) @fscanf(i32* %152, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i32* %17, i8* %19, i32* %160)
%162 = load i32, i32* %17
%163 = load i8, i8* %19
%164 = sext i8 %163 to i32
%165 = load i32**, i32*** %12
%166 = load i32, i32* %14
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i32*, i32** %165, i64 %167
%169 = load i32*, i32** %168
%170 = load i32, i32* %15
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i32, i32* %169, i64 %171
%173 = load i32, i32* %172
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i32 %162, i32 %164, i32 %173)
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
br label %176
176: ; preds = %151
%177 = load i32, i32* %15
%178 = add nsw i32 %177, 1
store i32 %178, i32* %15
br label %146
179: ; preds = %146
br label %180
180: ; preds = %179
%181 = load i32, i32* %14
%182 = add nsw i32 %181, 1
store i32 %182, i32* %14
br label %140
183: ; preds = %140
%184 = load i32**, i32*** %12
%185 = load i32***, i32**** %6
store i32** %184, i32*** %185
%186 = load i32*, i32** %13
%187 = load i32**, i32*** %7
store i32* %186, i32** %187
%188 = load i32*, i32** %11
%189 = call i32 @fclose(i32* %188)
ret void
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [6 x i8] c"Pause\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [3 x i8] c"%i\00"
@.str.6 = [31 x i8] c"\0AAlfabeto: %s\00"
@.str.7 = [32 x i8] c"\0AEstado Inicial: Q%i\00"
@.str.8 = [31 x i8] c"\0ANumero de Estados: %i\00"
@.str.9 = [32 x i8] c"\0ANumero de Estados Finiais: %i\0A\00"
@.str.12 = [21 x i8] c"\0AEstado Final = Q%i\09\00"
@.str.15 = [9 x i8] c"%i %c %i\00"
@.str.16 = [30 x i8] c"| Q%i | %c | Q%i |\0A\00"
@str = [57 x i8] c"\0A\0A\0ADigite o nome do arquivouivo (.txt) com a transicao: \00"
@str.17 = [32 x i8] c"\0A\0AFuncao de Transicao do A.F.D\0A\00"
@str.19 = [26 x i8] c"-------------------------\00"
@str.20 = [59 x i8] c"\0A\0AERROR: Nao foi possivel alocar o vetor de estados finais\00"
@str.21 = [58 x i8] c"\0A\0AERROR: Nao foi possivel alocar a transicao na matrizriz\00"
@str.22 = [134 x i8] c"\0A\0AERROR: Nao foi possivel ler o arquivouivo\0A\0AVerifique se o nome e/ou caminho estao corretos\0AA extensao do arquivouivo deve ser .txt\0A\00"
define void @openFile(i32*** nocapture writeonly %0, i32** nocapture writeonly %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca [50 x i8]
%10 = alloca [50 x i8]
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%16 = call i32 @gets(i8* %13)
%17 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %23
19: ; preds = %5
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([134 x i8], [134 x i8]* @str.22, i64 0, i64 0))
%21 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %5
%24 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %14)
%25 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%26 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%27 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %14)
%29 = load i32, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %2
%36 = shl i32 %35, 3
%37 = call i64 @malloc(i32 %36)
%38 = inttoptr i64 %37 to i32**
%39 = icmp eq i64 %37, 0
br i1 %39, label %43, label %40
40: ; preds = %23
%41 = load i32, i32* %2
%42 = icmp sgt i32 %41, 0
br i1 %42, label %51, label %62
43: ; preds = %23
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.21, i64 0, i64 0))
%45 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %51
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = icmp slt i64 %59, %49
br i1 %50, label %51, label %62
51: ; preds = %40, %47
%52 = phi i64 [ %59, %47 ], [ 0, %40 ]
%53 = call i32 @strlen(i8* %14)
%54 = shl i32 %53, 2
%55 = call i64 @malloc(i32 %54)
%56 = inttoptr i64 %55 to i32*
%57 = getelementptr inbounds i32*, i32** %38, i64 %52
store i32* %56, i32** %57
%58 = icmp eq i64 %55, 0
%59 = add nuw nsw i64 %52, 1
br i1 %58, label %60, label %47
60: ; preds = %51
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %47, %40
%63 = load i32, i32* %4
%64 = shl i32 %63, 2
%65 = call i64 @malloc(i32 %64)
%66 = inttoptr i64 %65 to i32*
%67 = icmp eq i64 %65, 0
br i1 %67, label %71, label %68
68: ; preds = %62
%69 = load i32, i32* %4
%70 = icmp sgt i32 %69, 0
br i1 %70, label %75, label %89
71: ; preds = %62
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.20, i64 0, i64 0))
%73 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%74 = call i32 @exit(i32 1)
unreachable
75: ; preds = %68, %75
%76 = phi i32 [ %86, %75 ], [ 0, %68 ]
%77 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %7)
%78 = load i32, i32* %7
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %66, i64 %79
store i32 %78, i32* %80
%81 = load i32, i32* %7
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i32, i32* %66, i64 %82
%84 = load i32, i32* %83
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i32 %84)
%86 = add nuw nsw i32 %76, 1
%87 = load i32, i32* %4
%88 = icmp slt i32 %86, %87
br i1 %88, label %75, label %89
89: ; preds = %75, %68
%90 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.17, i64 0, i64 0))
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.19, i64 0, i64 0))
%92 = load i32, i32* %2
%93 = icmp sgt i32 %92, 0
br i1 %93, label %94, label %122
94: ; preds = %89, %117
%95 = phi i64 [ %118, %117 ], [ 0, %89 ]
%96 = call i32 @strlen(i8* %14)
%97 = icmp sgt i32 %96, 0
br i1 %97, label %98, label %117
98: ; preds = %94
%99 = getelementptr inbounds i32*, i32** %38, i64 %95
br label %100
100: ; preds = %98, %100
%101 = phi i64 [ 0, %98 ], [ %113, %100 ]
%102 = load i32*, i32** %99
%103 = getelementptr inbounds i32, i32* %102, i64 %101
%104 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i32* %6, i8* %8, i32* %103)
%105 = load i32, i32* %6
%106 = load i8, i8* %8
%107 = sext i8 %106 to i32
%108 = load i32*, i32** %99
%109 = getelementptr inbounds i32, i32* %108, i64 %101
%110 = load i32, i32* %109
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i32 %105, i32 %107, i32 %110)
%112 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.19, i64 0, i64 0))
%113 = add nuw nsw i64 %101, 1
%114 = call i32 @strlen(i8* %14)
%115 = sext i32 %114 to i64
%116 = icmp slt i64 %113, %115
br i1 %116, label %100, label %117
117: ; preds = %100, %94
%118 = add nuw nsw i64 %95, 1
%119 = load i32, i32* %2
%120 = sext i32 %119 to i64
%121 = icmp slt i64 %118, %120
br i1 %121, label %94, label %122
122: ; preds = %117, %89
store i32** %38, i32*** %0
store i32* %66, i32** %1
%123 = call i32 @fclose(i32* %17)
ret void
}