// File: Sleepwalking[P]world-octave/matlabfunctions.cpp
// Function: (anonymous namespace)::CheckHeader(_IO_FILE*)
bool CheckHeader(FILE *fp) {
  char data_check[5];
  fread(data_check, 1, 4, fp);  // "RIFF"
  data_check[4] = '\0';
  if (0 != strcmp(data_check, "RIFF")) {
    printf("RIFF error.\n");
    return false;
  }
  fseek(fp, 4, SEEK_CUR);
  fread(data_check, 1, 4, fp);  // "WAVE"
  if (0 != strcmp(data_check, "WAVE")) {
    printf("WAVE error.\n");
    return false;
  }
  fread(data_check, 1, 4, fp);  // "fmt "
  if (0 != strcmp(data_check, "fmt ")) {
    printf("fmt error.\n");
    return false;
  }
  fread(data_check, 1, 4, fp);  // 1 0 0 0
  if (!(16 == data_check[0] && 0 == data_check[1] &&
      0 == data_check[2] && 0 == data_check[3])) {
    printf("fmt (2) error.\n");
    return false;
  }
  fread(data_check, 1, 2, fp);  // 1 0
  if (!(1 == data_check[0] && 0 == data_check[1])) {
    printf("Format ID error.\n");
    return false;
  }
  fread(data_check, 1, 2, fp);  // 1 0
  if (!(1 == data_check[0] && 0 == data_check[1])) {
    printf("This function cannot support stereo file\n");
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x15(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x1140
movb $0x0, -0x11(%rbp)
leaq -0x15(%rbp), %rdi
leaq 0x14248(%rip), %rsi     # 0x1c31a
callq 0x1130
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x80f6
leaq 0x14239(%rip), %rdi     # 0x1c31f
movb $0x0, %al
callq 0x1040
movb $0x0, -0x1(%rbp)
jmp 0x8276
movq -0x10(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x10e0
leaq -0x15(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x1140
leaq -0x15(%rbp), %rdi
leaq 0x14201(%rip), %rsi     # 0x1c32c
callq 0x1130
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x814f
leaq 0x141f2(%rip), %rdi     # 0x1c331
movb $0x0, %al
callq 0x1040
movb $0x0, -0x1(%rbp)
jmp 0x8276
leaq -0x15(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x1140
leaq -0x15(%rbp), %rdi
leaq 0x141cd(%rip), %rsi     # 0x1c33e
callq 0x1130
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x8195
leaq 0x141be(%rip), %rdi     # 0x1c343
movb $0x0, %al
callq 0x1040
movb $0x0, -0x1(%rbp)
jmp 0x8276
leaq -0x15(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x1140
movsbl -0x15(%rbp), %ecx
movl $0x10, %eax
cmpl %ecx, %eax
jne 0x81d7
movsbl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x81d7
movsbl -0x13(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x81d7
movsbl -0x12(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x81ee
leaq 0x14171(%rip), %rdi     # 0x1c34f
movb $0x0, %al
callq 0x1040
movb $0x0, -0x1(%rbp)
jmp 0x8276
leaq -0x15(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x2, %edx
callq 0x1140
movsbl -0x15(%rbp), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jne 0x821c
movsbl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x8230
leaq 0x1413c(%rip), %rdi     # 0x1c35f
movb $0x0, %al
callq 0x1040
movb $0x0, -0x1(%rbp)
jmp 0x8276
leaq -0x15(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1, %esi
movl $0x2, %edx
callq 0x1140
movsbl -0x15(%rbp), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jne 0x825e
movsbl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x8272
leaq 0x1410c(%rip), %rdi     # 0x1c371
movb $0x0, %al
callq 0x1040
movb $0x0, -0x1(%rbp)
jmp 0x8276
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)