#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 scalar_t__ off_t;

/* Variables and functions */
unsigned long getInputFileOffsetForLine(unsigned long);
unsigned long getInputLineNumberForFileOffset(scalar_t__);
int makePromise(char const *, unsigned long, scalar_t__, unsigned long,
                scalar_t__, scalar_t__);
int makePromiseForAreaSpecifiedWithOffsets(const char *parser,
                                           off_t startOffset, off_t endOffset) {
  unsigned long startLine = getInputLineNumberForFileOffset(startOffset);
  unsigned long endLine = getInputLineNumberForFileOffset(endOffset);
  unsigned long startLineOffset = getInputFileOffsetForLine(startLine);
  unsigned long endLineOffset = getInputFileOffsetForLine(endLine);
  return makePromise(parser, startLine, startOffset - startLineOffset, endLine,
                     endOffset - endLineOffset, startOffset - startLineOffset);
}


x86 assembly (clang, -O0):
<makePromiseForAreaSpecifiedWithOffsets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <getInputLineNumberForFileOffset@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <getInputLineNumberForFileOffset@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <getInputFileOffsetForLine@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <getInputFileOffsetForLine@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
sub    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%r8
sub    -0x38(%rbp),%r8
mov    -0x10(%rbp),%r9
sub    -0x30(%rbp),%r9
call   1030 <makePromise@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makePromiseForAreaSpecifiedWithOffsets>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
call   1050 <getInputLineNumberForFileOffset@plt>
mov    %rax,%r12
mov    %r14,%rdi
call   1050 <getInputLineNumberForFileOffset@plt>
mov    %rax,%r13
mov    %r12,%rdi
call   1040 <getInputFileOffsetForLine@plt>
mov    %rax,%rbp
mov    %r13,%rdi
call   1040 <getInputFileOffsetForLine@plt>
sub    %rbp,%rbx
sub    %rax,%r14
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %rbx,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <makePromise@plt>

LLVM IR (-O0):
define i32 @makePromiseForAreaSpecifiedWithOffsets(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%11 = load i64, i64* %5
%12 = call i64 @getInputLineNumberForFileOffset(i64 %11)
store i64 %12, i64* %7
%13 = load i64, i64* %6
%14 = call i64 @getInputLineNumberForFileOffset(i64 %13)
store i64 %14, i64* %8
%15 = load i64, i64* %7
%16 = call i64 @getInputFileOffsetForLine(i64 %15)
store i64 %16, i64* %9
%17 = load i64, i64* %8
%18 = call i64 @getInputFileOffsetForLine(i64 %17)
store i64 %18, i64* %10
%19 = load i8*, i8** %4
%20 = load i64, i64* %7
%21 = load i64, i64* %5
%22 = load i64, i64* %9
%23 = sub i64 %21, %22
%24 = load i64, i64* %8
%25 = load i64, i64* %6
%26 = load i64, i64* %10
%27 = sub i64 %25, %26
%28 = load i64, i64* %5
%29 = load i64, i64* %9
%30 = sub i64 %28, %29
%31 = call i32 @makePromise(i8* %19, i64 %20, i64 %23, i64 %24, i64 %27, i64 %30)
ret i32 %31
}

LLVM IR (-O2):
define i32 @makePromiseForAreaSpecifiedWithOffsets(i8* %0, i64 %1, i64 %2) {
%4 = tail call i64 @getInputLineNumberForFileOffset(i64 %1)
%5 = tail call i64 @getInputLineNumberForFileOffset(i64 %2)
%6 = tail call i64 @getInputFileOffsetForLine(i64 %4)
%7 = tail call i64 @getInputFileOffsetForLine(i64 %5)
%8 = sub i64 %1, %6
%9 = sub i64 %2, %7
%10 = tail call i32 @makePromise(i8* %0, i64 %4, i64 %8, i64 %5, i64 %9, i64 %8)
ret i32 %10
}