#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 */

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ strcmp(char *, char *);
int ifo_is_vts(int fd) {
  char ptr_descr[13];
  lseek(fd, 0, SEEK_SET);
  read(fd, ptr_descr, 12);
  ptr_descr[12] = '\0';
  if (!strcmp(ptr_descr, "DVDVIDEO-VTS")) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ifo_is_vts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    -0x8(%rbp),%edi
lea    -0x15(%rbp),%rsi
mov    $0xc,%edx
call   1040 <read@plt>
movb   $0x0,-0x9(%rbp)
lea    -0x15(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1188 <ifo_is_vts+0x58>
movl   $0x1,-0x4(%rbp)
jmp    118f <ifo_is_vts+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifo_is_vts>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
lea    0x3(%rsp),%rsi
mov    %ebx,%edi
mov    $0xc,%edx
call   1040 <read@plt>
movb   $0x0,0xf(%rsp)
movabs $0x4f45444956445644,%rcx
44 45 4f
xor    0x3(%rsp),%rcx
movabs $0x5354562d4f4544,%rdx
xor    0x8(%rsp),%rdx
xor    %eax,%eax
or     %rcx,%rdx
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [13 x i8] c"DVDVIDEO-VTS\00"
define i32 @ifo_is_vts(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [13 x i8]
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = load i32, i32* @SEEK_SET
%7 = call i32 @lseek(i32 %5, i32 0, i32 %6)
%8 = load i32, i32* %3
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 0
%10 = call i32 @read(i32 %8, i8* %9, i32 12)
%11 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 12
store i8 0, i8* %11
%12 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 0
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %1
store i32 1, i32* %2
br label %17
16: ; preds = %1
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@.str = [13 x i8] c"DVDVIDEO-VTS\00"
define i32 @ifo_is_vts(i32 %0) {
%2 = alloca [13 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @SEEK_SET
%5 = tail call i32 @lseek(i32 %0, i32 0, i32 %4)
%6 = call i32 @read(i32 %0, i8* %3, i32 12)
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 12
store i8 0, i8* %7
%8 = call i32 @bcmp(i8* dereferenceable(13) %3, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 13)
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}