#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 */
struct kp_file {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cline(struct kp_file *, int);
int /*<<< orphan*/ is_section_end(int /*<<< orphan*/, int *);
scalar_t__ is_section_start(int /*<<< orphan*/, char *);
int skip_section(struct kp_file *f, int l0, char *prefix) {
  int l = l0;
  while (is_section_start(cline(f, l), prefix)) {
    l++;
    while (!is_section_end(cline(f, l), &l))
      l++;
  }
  return l - l0;
}


x86 assembly (clang, -O0):
<skip_section>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <cline@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
call   1040 <is_section_start@plt>
cmp    $0x0,%rax
je     11b2 <skip_section+0x82>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <cline@plt>
mov    %eax,%edi
lea    -0x1c(%rbp),%rsi
call   1050 <is_section_end@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    119f <skip_section+0x6f>
jmp    11ad <skip_section+0x7d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1173 <skip_section+0x43>
jmp    1149 <skip_section+0x19>
mov    -0x1c(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_section>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %esi,0x4(%rsp)
call   1030 <cline@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <is_section_start@plt>
mov    %rax,%rcx
mov    %r14d,%eax
test   %rcx,%rcx
je     11b0 <skip_section+0x80>
lea    0x4(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x4(%rsp),%esi
add    $0x1,%esi
mov    %esi,0x4(%rsp)
mov    %rbp,%rdi
call   1030 <cline@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1050 <is_section_end@plt>
test   %eax,%eax
je     1170 <skip_section+0x40>
mov    0x4(%rsp),%esi
mov    %rbp,%rdi
call   1030 <cline@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <is_section_start@plt>
test   %rax,%rax
jne    1170 <skip_section+0x40>
mov    0x4(%rsp),%eax
sub    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.kp_file = type { i32 }
define i32 @skip_section(%struct.kp_file* %0, i32 %1, i8* %2) {
%4 = alloca %struct.kp_file*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store %struct.kp_file* %0, %struct.kp_file** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i32, i32* %5
store i32 %8, i32* %7
br label %9
9: ; preds = %29, %3
%10 = load %struct.kp_file*, %struct.kp_file** %4
%11 = load i32, i32* %7
%12 = call i32 @cline(%struct.kp_file* %10, i32 %11)
%13 = load i8*, i8** %6
%14 = call i64 @is_section_start(i32 %12, i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %9
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
br label %19
19: ; preds = %26, %16
%20 = load %struct.kp_file*, %struct.kp_file** %4
%21 = load i32, i32* %7
%22 = call i32 @cline(%struct.kp_file* %20, i32 %21)
%23 = call i32 @is_section_end(i32 %22, i32* %7)
%24 = icmp ne i32 %23, 0
%25 = xor i1 %24, true
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %19
29: ; preds = %19
br label %9
30: ; preds = %9
%31 = load i32, i32* %7
%32 = load i32, i32* %5
%33 = sub nsw i32 %31, %32
ret i32 %33
}

LLVM IR (-O2):
%struct.kp_file = type { i32 }
define i32 @skip_section(%struct.kp_file* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 %1, i32* %4
%6 = call i32 @cline(%struct.kp_file* %0, i32 %1)
%7 = call i64 @is_section_start(i32 %6, i8* %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %23, label %14
9: ; preds = %14
%10 = load i32, i32* %4
%11 = call i32 @cline(%struct.kp_file* %0, i32 %10)
%12 = call i64 @is_section_start(i32 %11, i8* %2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %21, label %20
14: ; preds = %3, %20
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
%17 = call i32 @cline(%struct.kp_file* %0, i32 %16)
%18 = call i32 @is_section_end(i32 %17, i32* %4)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %9
20: ; preds = %14, %9
br label %14
21: ; preds = %9
%22 = load i32, i32* %4
br label %23
23: ; preds = %21, %3
%24 = phi i32 [ %22, %21 ], [ %1, %3 ]
%25 = sub nsw i32 %24, %1
ret i32 %25
}