#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*/ copy_line(int);
scalar_t__ is_range_in_range(int, int);
int /*<<< orphan*/ print_error(char *);
void copy_line_range(int start, int end) {
  int i;
  if (is_range_in_range(start, end)) {
    for (i = start; i <= end; i++) {
      copy_line(i);
    }
  } else {
    print_error("lines out of range");
  }
}


x86 assembly (clang, -O0):
<copy_line_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <is_range_in_range@plt>
cmp    $0x0,%rax
je     1180 <copy_line_range+0x50>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     117b <copy_line_range+0x4b>
mov    -0xc(%rbp),%edi
call   1050 <copy_line@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <copy_line_range+0x29>
jmp    118c <copy_line_range+0x5c>
lea    0xe79(%rip),%rdi
call   1040 <print_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_line_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <is_range_in_range@plt>
test   %rax,%rax
je     1165 <copy_line_range+0x35>
cmp    %ebx,%ebp
jg     115e <copy_line_range+0x2e>
add    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1050 <copy_line@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1150 <copy_line_range+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe94(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <print_error@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"lines out of range\00"
define void @copy_line_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i64 @is_range_in_range(i32 %6, i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %2
%11 = load i32, i32* %3
store i32 %11, i32* %5
br label %12
12: ; preds = %19, %10
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i32, i32* %5
%18 = call i32 @copy_line(i32 %17)
br label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %12
22: ; preds = %12
br label %25
23: ; preds = %2
%24 = call i32 @print_error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %22
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"lines out of range\00"
define void @copy_line_range(i32 %0, i32 %1) {
%3 = tail call i64 @is_range_in_range(i32 %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = icmp sgt i32 %0, %1
br i1 %6, label %14, label %7
7: ; preds = %5, %7
%8 = phi i32 [ %10, %7 ], [ %0, %5 ]
%9 = tail call i32 @copy_line(i32 %8)
%10 = add i32 %8, 1
%11 = icmp eq i32 %8, %1
br i1 %11, label %14, label %7
12: ; preds = %2
%13 = tail call i32 @print_error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %7, %5, %12
ret void
}