#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int getid3v1(FILE *file_input) {
  fseek(file_input, -128, SEEK_END);
  if (fgetc(file_input) == 'T')
    if (fgetc(file_input) == 'A')
      if (fgetc(file_input) == 'G')
        return -128;
  return 0;
}


x86 assembly (clang, -O0):
<getid3v1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
mov    $0xffffff80,%esi
call   1040 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
movsbl %al,%eax
cmp    $0x54,%eax
jne    1198 <getid3v1+0x78>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
movsbl %al,%eax
cmp    $0x41,%eax
jne    1193 <getid3v1+0x73>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
movsbl %al,%eax
cmp    $0x47,%eax
jne    118e <getid3v1+0x6e>
movl   $0xffffff80,-0x4(%rbp)
jmp    119f <getid3v1+0x7f>
jmp    1193 <getid3v1+0x73>
jmp    1198 <getid3v1+0x78>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getid3v1>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ebd(%rip),%rax
mov    (%rax),%edx
mov    $0xffffff80,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0x54,%al
jne    1163 <getid3v1+0x43>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0x41,%al
jne    1163 <getid3v1+0x43>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    $0xffffff80,%eax
cmp    $0x47,%cl
je     1165 <getid3v1+0x45>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
define i32 @getid3v1(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i32 -128, i32 %5)
%7 = load i32*, i32** %3
%8 = call signext i8 @fgetc(i32* %7)
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 84
br i1 %10, label %11, label %24
11: ; preds = %1
%12 = load i32*, i32** %3
%13 = call signext i8 @fgetc(i32* %12)
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 65
br i1 %15, label %16, label %23
16: ; preds = %11
%17 = load i32*, i32** %3
%18 = call signext i8 @fgetc(i32* %17)
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 71
br i1 %20, label %21, label %22
21: ; preds = %16
store i32 -128, i32* %2
br label %25
22: ; preds = %16
br label %23
23: ; preds = %22, %11
br label %24
24: ; preds = %23, %1
store i32 0, i32* %2
br label %25
25: ; preds = %24, %21
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@SEEK_END = global i32 0
define i32 @getid3v1(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i32 -128, i32 %2)
%4 = tail call signext i8 @fgetc(i32* %0)
%5 = icmp eq i8 %4, 84
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = tail call signext i8 @fgetc(i32* %0)
%8 = icmp eq i8 %7, 65
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call signext i8 @fgetc(i32* %0)
%11 = icmp eq i8 %10, 71
br i1 %11, label %13, label %12
12: ; preds = %6, %9, %1
br label %13
13: ; preds = %9, %12
%14 = phi i32 [ 0, %12 ], [ -128, %9 ]
ret i32 %14
}