#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 skipControlExtension(void) {
  int size, i;
  size = getbits(8);
  for (i = 0; i < size; i++) {
    getbits(8);
  }
  int temp = getbits(8);
  if (temp != 0) {
    fprintf(stderr, "Expected to be at the end of a ");
    fprintf(stderr,
            "\ncontrol block, but I'm not.   Probably about to cause a \n");
    fprintf(stderr,
            "segmentation fault.  Goodbye in case I never see you again...\n");
  }
}


x86 assembly (clang, -O0):
<skipControlExtension>:
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 <skipControlExtension+0x40>
mov    $0x8,%edi
call   1030 <getbits@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113c <skipControlExtension+0x1c>
mov    $0x8,%edi
call   1030 <getbits@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11b6 <skipControlExtension+0x96>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipControlExtension>:
push   %rbx
mov    $0x8,%edi
call   1030 <getbits@plt>
test   %eax,%eax
jle    114f <skipControlExtension+0x2f>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x8,%edi
call   1030 <getbits@plt>
add    $0xffffffff,%ebx
jne    1140 <skipControlExtension+0x20>
mov    $0x8,%edi
call   1030 <getbits@plt>
test   %eax,%eax
je     118f <skipControlExtension+0x6f>
mov    0x2e7c(%rip),%rbx
mov    (%rbx),%edi
lea    0xe93(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xea5(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed2(%rip),%rsi
pop    %rbx
jmp    1040 <fprintf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Expected to be at the end of a \00"
@.str.1 = [59 x i8] c"\0Acontrol block, but I'm not. Probably about to cause a \0A\00"
@.str.2 = [63 x i8] c"segmentation fault. Goodbye in case I never see you again...\0A\00"
define void @skipControlExtension() {
%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 %25
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %18, %14
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Expected to be at the end of a \00"
@.str.1 = [59 x i8] c"\0Acontrol block, but I'm not. Probably about to cause a \0A\00"
@.str.2 = [63 x i8] c"segmentation fault. Goodbye in case I never see you again...\0A\00"
define void @skipControlExtension() {
%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 %18, label %11
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %11, %8
ret void
}