// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/theindiependencegame.c
// Function: intro
void _intro(){
    sc_rectangle *intro;
    FILE * in;
    char *dialog=NULL, *ini, line[INTRO_LINE],choice, buff[MAX], *intropath = "intro.txt";
    int len,j=0,linenumber,x,y;

    intro = win_new(0,0,INTROY,INTROX,BGCOLOR,CHARCOLOR); /*Creating the intro window, which occupies all the screen.*/
    in = (FILE*) fopen(intropath, "r"); /*Openning the intro txt file which contains every dialog from the intro.*/

	if(!in) exit(-1);
    if (!intro) exit(-1);

	while(!feof(in)){
	  win_cls(intro);
		fscanf(in,"%d\t%d\t%[^\n]s",&x,&y,buff);
		linenumber=y;
		if(dialog) free(dialog);
		len = strlen(buff);
		dialog = (char*) malloc(len+1);
		strcpy(dialog,buff);
    ini=dialog;
    j=0;
    while(j<len && linenumber<INTROY){
      dialog = ini + j;
      memcpy(line,dialog,INTRO_LINE);
      win_write_line_at(intro,linenumber,x,line);
      j+=INTRO_LINE;
      linenumber++;
    }
		dialog = ini;
		choice = fgetc(stdin);
		while(choice!='a' && choice!='A' && choice!='\n'){
		    choice = fgetc(stdin);
		}
		if(choice=='\n'){
		    break;
		}
	}

	fclose(in);
	in = (FILE*) fopen("startmenu.txt", "r");
	win_cls(intro);
    while(!feof(in)){
		fscanf(in,"%d\t%d\t%[^\n]s",&x,&y,buff);
		len = strlen(buff);
		if(dialog) free(dialog);
		dialog = (char*) malloc(len+1);
		strcpy(dialog,buff);
    ini=dialog;
    j=0;
    while(j<len && linenumber<INTROY){
      dialog = ini + j;
      memcpy(line,dialog,INTRO_LINE);
      win_write_line_at(intro,y,x,line);
      j+=INTRO_LINE;
      linenumber++;
    }
		
    }
		choice = fgetc(stdin);
		while(choice!='q' && choice!='Q' && choice!='\n'){
		    choice = fgetc(stdin);
		}
		if(choice=='q' || choice == 'Q'){
		    exit(0);
		}
    fclose(in);
    win_delete(intro);
		if(dialog) free(dialog);
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2788, %rsp           # imm = 0x2788
xorl %edi, %edi
xorl %esi, %esi
movl $0x2e, %edx
movl $0x78, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x3f23
movq %rax, %rbx
leaq 0x4b69(%rip), %rdi      # 0x6030
leaq 0x4b6c(%rip), %rsi      # 0x603a
callq 0x1190
testq %rax, %rax
je 0x17f1
testq %rbx, %rbx
je 0x17f1
movq %rax, %r12
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
je 0x14fc
xorl %r14d, %r14d
jmp 0x163a
leaq 0x70(%rsp), %r13
xorl %r14d, %r14d
movq %r12, 0x10(%rsp)
movq %rbx, %rdi
callq 0x3f6e
movq %r12, %rdi
leaq 0x4b21(%rip), %rsi      # 0x603c
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x1060
movl 0x8(%rsp), %ebp
testq %r14, %r14
je 0x1540
movq %r14, %rdi
callq 0x1030
movq %r13, %rdi
callq 0x1080
movq %rax, %r12
shlq $0x20, %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
leaq (%rax,%rcx), %rdi
sarq $0x20, %rdi
callq 0x1130
movq %rax, %r14
movq %rax, %rdi
movq %r13, %rsi
callq 0x1050
testl %r12d, %r12d
setg %al
cmpl $0x2e, %ebp
setl %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x15c8
xorl %r13d, %r13d
leaq (%r14,%r13), %rsi
movl $0x41, %edx
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x1100
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rcx
callq 0x4081
addq $0x41, %r13
leal 0x1(%rbp), %r15d
cmpl %r12d, %r13d
jge 0x15cb
cmpl $0x2d, %ebp
movl %r15d, %ebp
jl 0x158a
jmp 0x15cb
movl %ebp, %r15d
movq 0x8a0e(%rip), %rbp      # 0x9fe0
movq (%rbp), %rdi
callq 0x10d0
movl %eax, %ecx
shll $0x18, %ecx
andl $0xdf, %eax
cmpl $0x41, %eax
sete %al
cmpl $0xa000000, %ecx        # imm = 0xA000000
sete %dl
orb %al, %dl
movq 0x10(%rsp), %r12
leaq 0x70(%rsp), %r13
jne 0x1622
movq (%rbp), %rdi
callq 0x10d0
movl %eax, %ecx
shll $0x18, %ecx
andl $0xdf, %eax
cmpl $0x41, %eax
je 0x1622
cmpl $0xa000000, %ecx        # imm = 0xA000000
jne 0x1602
cmpl $0xa000000, %ecx        # imm = 0xA000000
je 0x163a
movq %r12, %rdi
callq 0x10f0
testl %eax, %eax
je 0x1509
movq %r12, %rdi
callq 0x1070
leaq 0x4a00(%rip), %rdi      # 0x6049
leaq 0x49ea(%rip), %rsi      # 0x603a
callq 0x1190
movq %rax, %r12
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
callq 0x3f6e
movq %r12, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x175a
leaq 0x70(%rsp), %rbx
leaq 0x20(%rsp), %r13
movq %r12, 0x18(%rsp)
movq %r12, %rdi
leaq 0x49ae(%rip), %rsi      # 0x603c
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1080
movq %rax, %rbp
testq %r14, %r14
je 0x16ba
movq %r14, %rdi
callq 0x1030
movq %rbp, %rdi
shlq $0x20, %rdi
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rdi
sarq $0x20, %rdi
callq 0x1130
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1050
testl %ebp, %ebp
jle 0x173a
cmpl $0x2d, %r15d
jg 0x173a
addq $-0x41, %r14
movl $0x41, %r12d
addq $0x41, %r14
movl $0x41, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x1100
movl 0x8(%rsp), %esi
movl 0xc(%rsp), %edx
movq 0x10(%rsp), %rdi
movq %r13, %rcx
callq 0x4081
leal 0x1(%r15), %ebx
cmpl %ebp, %r12d
jge 0x173d
addl $0x41, %r12d
cmpl $0x2d, %r15d
movl %ebx, %r15d
jl 0x16f9
jmp 0x173d
movl %r15d, %ebx
movq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x10f0
movl %ebx, %r15d
testl %eax, %eax
leaq 0x70(%rsp), %rbx
je 0x1684
movq 0x887f(%rip), %r15      # 0x9fe0
movq (%r15), %rdi
callq 0x10d0
movl %eax, %ecx
shll $0x18, %ecx
movl %eax, %edx
andl $0xdf, %edx
cmpl $0x51, %edx
sete %dl
cmpl $0xa000000, %ecx        # imm = 0xA000000
sete %sil
orb %dl, %sil
movq 0x10(%rsp), %rbx
jne 0x17b2
movq (%r15), %rdi
callq 0x10d0
movl %eax, %ecx
shll $0x18, %ecx
movl %eax, %edx
andl $0xdf, %edx
cmpl $0x51, %edx
je 0x17b2
cmpl $0xa000000, %ecx        # imm = 0xA000000
jne 0x1790
cmpl $0x71000000, %ecx       # imm = 0x71000000
je 0x17fb
andl $0x7b, %eax
cmpl $0x51, %eax
je 0x17fb
movq %r12, %rdi
callq 0x1070
movq %rbx, %rdi
callq 0x4019
testq %r14, %r14
je 0x17df
movq %r14, %rdi
callq 0x1030
addq $0x2788, %rsp           # imm = 0x2788
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x11b0
xorl %edi, %edi
callq 0x11b0