// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/ensight_writer.c
// Function: WriteCaseFile
static void WriteCaseFile(const Time *time, EnSet *enSet)
{
    snprintf(enSet->fname, sizeof(EnStr), "%s.case", enSet->bname);
    FILE *fp = Fopen(enSet->fname, "w");
    fprintf(fp, "FORMAT\n");
    fprintf(fp, "type: ensight gold\n");
    fprintf(fp, "\n");
    fprintf(fp, "GEOMETRY\n");
    if ('\0' == *enSet->gtag) {
        fprintf(fp, "model: %s.geo\n", enSet->rname);
    } else {
        fprintf(fp, "model: %s.geo\n", enSet->bname);
    }
    fprintf(fp, "\n");
    fprintf(fp, "VARIABLE\n");
    fprintf(fp, "constant per case:  Time  %.6g\n", time->now);
    fprintf(fp, "constant per case:  Step  %d\n", time->stepC);
    for (int n = 0; n < enSet->scaN; ++n) {
        fprintf(fp, "scalar per node:     %3s  %s.%s\n",
                enSet->sca[n], enSet->bname, enSet->sca[n]);
    }
    for (int n = 0; n < enSet->vecN; ++n) {
        fprintf(fp, "vector per node:     %3s  %s.%s\n",
                enSet->vec[n], enSet->bname, enSet->vec[n]);
    }
    fprintf(fp, "\n");
    fclose(fp);
    /* add case to the transient case file */
    snprintf(enSet->fname, sizeof(EnStr), "%s.case", enSet->rname);
    fp = Fopen(enSet->fname, "r+");
    /* seek the target line for adding information */
    ReadInLine(fp, "time set: 1");
    fprintf(fp, "number of steps:          %d", (time->dataC + 1));
    /* add the time flag of current export to the transient case */
    fseek(fp, 0, SEEK_END); /* seek to the end of file */
    if ((time->dataC % 5) == 0) { /* print to a new line every x outputs */
        fprintf(fp, "\n");
    }
    fprintf(fp, "%.6g ", time->now);
    fclose(fp);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
addq $0xa0, %rdi
movq -0x10(%rbp), %rcx
addq $0x50, %rcx
movl $0x50, %esi
leaq 0x1221d(%rip), %rdx     # 0x284ec
movb $0x0, %al
callq 0x20b0
movq -0x10(%rbp), %rdi
addq $0xa0, %rdi
leaq 0x10b94(%rip), %rsi     # 0x26e7c
callq 0xbf90
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x129a8(%rip), %rsi     # 0x28ca4
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rdi
leaq 0x1299e(%rip), %rsi     # 0x28cac
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rdi
leaq 0x12a43(%rip), %rsi     # 0x28d63
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rdi
leaq 0x1298e(%rip), %rsi     # 0x28cc0
movb $0x0, %al
callq 0x2140
movq -0x10(%rbp), %rax
movsbl 0x190(%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x16362
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x12a55(%rip), %rsi     # 0x28dae
movb $0x0, %al
callq 0x2140
jmp 0x1637c
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x50, %rdx
leaq 0x12a39(%rip), %rsi     # 0x28dae
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rdi
leaq 0x129dc(%rip), %rsi     # 0x28d63
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rdi
leaq 0x12942(%rip), %rsi     # 0x28cdb
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x48(%rax), %xmm0
leaq 0x12a09(%rip), %rsi     # 0x28dbd
movb $0x1, %al
callq 0x2140
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0x12a10(%rip), %rsi     # 0x28ddd
movb $0x0, %al
callq 0x2140
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x288(%rcx), %eax
jge 0x1643b
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x28c, %rdx            # imm = 0x28C
movslq -0x1c(%rbp), %rax
imulq $0xa, %rax, %rax
addq %rax, %rdx
movq -0x10(%rbp), %rcx
addq $0x50, %rcx
movq -0x10(%rbp), %r8
addq $0x28c, %r8             # imm = 0x28C
movslq -0x1c(%rbp), %rax
imulq $0xa, %rax, %rax
addq %rax, %r8
leaq 0x129d2(%rip), %rsi     # 0x28dfb
movb $0x0, %al
callq 0x2140
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x163db
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x2f0(%rcx), %eax
jge 0x164a2
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x2f4, %rdx            # imm = 0x2F4
movslq -0x20(%rbp), %rax
imulq $0xa, %rax, %rax
addq %rax, %rdx
movq -0x10(%rbp), %rcx
addq $0x50, %rcx
movq -0x10(%rbp), %r8
addq $0x2f4, %r8             # imm = 0x2F4
movslq -0x20(%rbp), %rax
imulq $0xa, %rax, %rax
addq %rax, %r8
leaq 0x1298c(%rip), %rsi     # 0x28e1c
movb $0x0, %al
callq 0x2140
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x16442
movq -0x18(%rbp), %rdi
leaq 0x128b6(%rip), %rsi     # 0x28d63
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rdi
callq 0x2080
movq -0x10(%rbp), %rdi
addq $0xa0, %rdi
movq -0x10(%rbp), %rcx
movl $0x50, %esi
leaq 0x12014(%rip), %rdx     # 0x284ec
movb $0x0, %al
callq 0x20b0
movq -0x10(%rbp), %rdi
addq $0xa0, %rdi
leaq 0x1294c(%rip), %rsi     # 0x28e3d
callq 0xbf90
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x1293b(%rip), %rsi     # 0x28e40
callq 0xbe50
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x38(%rax), %edx
addl $0x1, %edx
leaq 0x1292d(%rip), %rsi     # 0x28e4c
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x2180
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
movl $0x5, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x1655e
movq -0x18(%rbp), %rdi
leaq 0x1280c(%rip), %rsi     # 0x28d63
movb $0x0, %al
callq 0x2140
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x48(%rax), %xmm0
leaq 0x140f8(%rip), %rsi     # 0x2a66a
movb $0x1, %al
callq 0x2140
movq -0x18(%rbp), %rdi
callq 0x2080
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)