#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int getbits(int);
int /*<<< orphan*/ stderr;
void skipApplicationExtension(void) {
  int length, i;
  length = getbits(8);
  for (i = 0; i < length; i++)
    getbits(8);
  int t = getbits(8);
  if (t != 0) {
    fprintf(stderr,
            "In Application extension, expected 0 Block Terminator but got ");
    fprintf(stderr, "%d.  Will continue processing, but without much hope...\n",
            t);
  }
}


x86 assembly (clang, -O0):
<skipApplicationExtension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
call   1030 <getbits@plt>
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1160 <skipApplicationExtension+0x40>
mov    $0x8,%edi
call   1030 <getbits@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113c <skipApplicationExtension+0x1c>
mov    $0x8,%edi
call   1030 <getbits@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11a8 <skipApplicationExtension+0x88>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipApplicationExtension>:
push   %r14
push   %rbx
push   %rax
mov    $0x8,%edi
call   1030 <getbits@plt>
test   %eax,%eax
jle    114f <skipApplicationExtension+0x2f>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x8,%edi
call   1030 <getbits@plt>
add    $0xffffffff,%ebx
jne    1140 <skipApplicationExtension+0x20>
mov    $0x8,%edi
call   1030 <getbits@plt>
test   %eax,%eax
je     1191 <skipApplicationExtension+0x71>
mov    %eax,%ebx
mov    0x2e7a(%rip),%r14
mov    (%r14),%edi
lea    0xe90(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xebe(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [63 x i8] c"In Application extension, expected 0 Block Terminator but got \00"
@.str.1 = [57 x i8] c"%d. Will continue processing, but without much hope...\0A\00"
define void @skipApplicationExtension() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @getbits(i32 8)
store i32 %4, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %11, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = call i32 @getbits(i32 8)
br label %11
11: ; preds = %9
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %5
14: ; preds = %5
%15 = call i32 @getbits(i32 8)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* @stderr
%22 = load i32, i32* %3
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %18, %14
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [63 x i8] c"In Application extension, expected 0 Block Terminator but got \00"
@.str.1 = [57 x i8] c"%d. Will continue processing, but without much hope...\0A\00"
define void @skipApplicationExtension() {
%1 = tail call i32 @getbits(i32 8)
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ 0, %0 ]
%5 = tail call i32 @getbits(i32 8)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %1
br i1 %7, label %8, label %3
8: ; preds = %3, %0
%9 = tail call i32 @getbits(i32 8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %16
16: ; preds = %11, %8
ret void
}