#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_SET;
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
void video_stream_info(FILE *f, int len) {
  int orig_pos = ftell(f);
  unsigned char data[len - 8];
  int i;
  len -= 8;
  for (i = 0; i < len; i++)
    fread(&data[i], 1, 1, f);
  fseek(f, orig_pos, SEEK_SET);
}


x86 assembly (clang, -O0):
<video_stream_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ftell@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffff8,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b9 <video_stream_info+0x89>
mov    -0x30(%rbp),%rdi
movslq -0x24(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1184 <video_stream_info+0x54>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    0x2e19(%rip),%rax
mov    (%rax),%edx
call   1050 <fseek@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<video_stream_info>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r12d
mov    %rdi,%r15
call   1040 <ftell@plt>
mov    %eax,%r14d
lea    -0x8(%r12),%r13d
mov    %rsp,%rbx
lea    0xf(%r13),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    $0x9,%r12d
jl     118f <video_stream_info+0x5f>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
add    $0x1,%rbx
add    $0xffffffffffffffff,%r13
jne    1170 <video_stream_info+0x40>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %r14d,%esi
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fseek@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
define void @video_stream_info(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%9 = load i32*, i32** %3
%10 = call i32 @ftell(i32* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 8
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %6
%15 = alloca i8, i64 %13
store i64 %13, i64* %7
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 8
store i32 %17, i32* %4
store i32 0, i32* %8
br label %18
18: ; preds = %28, %2
%19 = load i32, i32* %8
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %31
22: ; preds = %18
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %15, i64 %24
%26 = load i32*, i32** %3
%27 = call i32 @fread(i8* %25, i32 1, i32 1, i32* %26)
br label %28
28: ; preds = %22
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %18
31: ; preds = %18
%32 = load i32*, i32** %3
%33 = load i32, i32* %5
%34 = load i32, i32* @SEEK_SET
%35 = call i32 @fseek(i32* %32, i32 %33, i32 %34)
%36 = load i8*, i8** %6
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define void @video_stream_info(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @ftell(i32* %0)
%4 = add i32 %1, -8
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = icmp sgt i32 %1, 8
br i1 %7, label %8, label %14
8: ; preds = %2, %8
%9 = phi i64 [ %12, %8 ], [ 0, %2 ]
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = call i32 @fread(i8* %10, i32 1, i32 1, i32* %0)
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %8
14: ; preds = %8, %2
%15 = load i32, i32* @SEEK_SET
%16 = tail call i32 @fseek(i32* %0, i32 %3, i32 %15)
ret void
}