// File: /workspace/github_c_makefile_star2_O0/vlenhart[P]q3bsp/q3shader.cpp
// Function: QuakeShaderFactory::AddShader(StringRef const&)
bool  QuakeShaderFactory::AddShader(const StringRef &sname)
{

  mBraceCount = 0;
  mCurrent    = 0;

  mCurrentStage = 0;

  char filename[1024];
  sprintf(filename, "scripts/%s", sname.Get());
  Fload shader(filename);

  if (!shader.GetData()) {
    printf("***********SHADER FILE NOT FOUND in scripts/ : %s \n",sname.c_str());
    return false;
  }

  // TODO (vlaube): should we use the full filename here?
  mShaderFiles[sname] = true; 

  printf("***********SHADER FILE PROCESS : %s \n",sname.c_str());

  while ( 1 )
  {

    char *str = shader.GetString();

    if ( !str ) break;

    ShaderString(str); // process one string.
  }

  delete mCurrent;
  mCurrent = 0;
  delete mCurrentStage;
  mCurrentStage = 0;
  return true;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4e0, %rsp            # imm = 0x4E0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x4a0(%rbp)
movl $0x0, 0x18(%rax)
movq $0x0, 0x20(%rax)
movq $0x0, 0x28(%rax)
movq -0x18(%rbp), %rdi
callq 0xdd00
movq %rax, %rdx
leaq 0xf4ac(%rip), %rsi      # 0x2a5a4
xorl %eax, %eax
leaq -0x420(%rbp), %rdi
movq %rdi, -0x498(%rbp)
callq 0x30a0
leaq -0x469(%rbp), %rdi
movq %rdi, -0x490(%rbp)
callq 0x3500
movq -0x498(%rbp), %rsi
movq -0x490(%rbp), %rdx
leaq -0x468(%rbp), %rdi
callq 0x92b0
jmp 0x1b13c
leaq -0x448(%rbp), %rdi
leaq -0x468(%rbp), %rsi
callq 0xd8d0
jmp 0x1b151
leaq -0x468(%rbp), %rdi
callq 0x3180
leaq -0x469(%rbp), %rdi
callq 0x32e0
leaq -0x448(%rbp), %rdi
callq 0x93e0
movq %rax, -0x4a8(%rbp)
jmp 0x1b17e
movq -0x4a8(%rbp), %rax
cmpq $0x0, %rax
jne 0x1b231
movq -0x18(%rbp), %rdi
callq 0x1cff0
movq %rax, -0x4b0(%rbp)
jmp 0x1b1a1
movq -0x4b0(%rbp), %rsi
leaq 0xf400(%rip), %rdi      # 0x2a5af
xorl %eax, %eax
callq 0x3060
jmp 0x1b1b8
movb $0x0, -0x1(%rbp)
movl $0x1, -0x480(%rbp)
jmp 0x1b35a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x478(%rbp)
movl %eax, -0x47c(%rbp)
jmp 0x1b1fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x478(%rbp)
movl %eax, -0x47c(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x3180
leaq -0x469(%rbp), %rdi
callq 0x32e0
jmp 0x1b374
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x478(%rbp)
movl %eax, -0x47c(%rbp)
leaq -0x448(%rbp), %rdi
callq 0xda80
jmp 0x1b374
movq -0x4a0(%rbp), %rdi
addq $0x60, %rdi
movq -0x18(%rbp), %rsi
callq 0x1d010
movq %rax, -0x4b8(%rbp)
jmp 0x1b24e
movq -0x4b8(%rbp), %rax
movb $0x1, (%rax)
movq -0x18(%rbp), %rdi
callq 0x1cff0
movq %rax, -0x4c0(%rbp)
jmp 0x1b26a
movq -0x4c0(%rbp), %rsi
leaq 0xf36b(%rip), %rdi      # 0x2a5e3
xorl %eax, %eax
callq 0x3060
jmp 0x1b281
jmp 0x1b283
jmp 0x1b285
leaq -0x448(%rbp), %rdi
callq 0xdac0
movq %rax, -0x4c8(%rbp)
jmp 0x1b29a
movq -0x4c8(%rbp), %rax
movq %rax, -0x488(%rbp)
cmpq $0x0, -0x488(%rbp)
jne 0x1b2b4
jmp 0x1b2cb
movq -0x4a0(%rbp), %rdi
movq -0x488(%rbp), %rsi
callq 0x1b5b0
jmp 0x1b2c9
jmp 0x1b283
movq -0x4a0(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x4d0(%rbp)
cmpq $0x0, %rax
je 0x1b300
movq -0x4d0(%rbp), %rdi
callq 0x1ce80
movq -0x4d0(%rbp), %rdi
movl $0x68, %esi
callq 0x32b0
movq -0x4a0(%rbp), %rax
movq $0x0, 0x20(%rax)
movq 0x28(%rax), %rax
movq %rax, -0x4d8(%rbp)
cmpq $0x0, %rax
je 0x1b33d
movq -0x4d8(%rbp), %rdi
callq 0x1d0f0
movq -0x4d8(%rbp), %rdi
movl $0xb8, %esi
callq 0x32b0
movq -0x4a0(%rbp), %rax
movq $0x0, 0x28(%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x480(%rbp)
leaq -0x448(%rbp), %rdi
callq 0xda80
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x4e0, %rsp            # imm = 0x4E0
popq %rbp
retq
movq -0x478(%rbp), %rdi
callq 0x34f0