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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, ...);
int /*<<< orphan*/ prepare(int, char *, size_t);
int /*<<< orphan*/ stderr;
int system(char *);
int test(char *cmdline, char *input, off_t start, size_t len, int output_fd) {
  int r;
  prepare(output_fd, input + start, len);
  fprintf(stderr, "[%lu, %lu]...", start, start + len);
  r = system(cmdline);
  fprintf(stderr, "%d\n", r);
  return r;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
mov    -0x20(%rbp),%rdx
call   1050 <prepare@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
movslq -0x14(%rbp),%rcx
add    -0x20(%rbp),%rcx
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x28(%rbp)
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdi,%r14
movslq %edx,%r15
add    %r15,%rsi
mov    %r8d,%edi
mov    %rcx,%rdx
call   1050 <prepare@plt>
mov    0x2e8a(%rip),%r12
mov    (%r12),%edi
add    %r15,%rbx
lea    0xe9c(%rip),%rsi
mov    %r15d,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
mov    %eax,%ebx
mov    (%r12),%edi
lea    0xe88(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"[%lu, %lu]...\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @test(i8* %0, i8* %1, i32 %2, i64 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i64 %3, i64* %9
store i32 %4, i32* %10
%12 = load i32, i32* %10
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i64, i64* %9
%18 = call i32 @prepare(i32 %12, i8* %16, i64 %17)
%19 = load i32, i32* @stderr
%20 = load i32, i32* %8
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = load i64, i64* %9
%24 = add i64 %22, %23
%25 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %20, i64 %24)
%26 = load i8*, i8** %6
%27 = call i32 @system(i8* %26)
store i32 %27, i32* %11
%28 = load i32, i32* @stderr
%29 = load i32, i32* %11
%30 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %11
ret i32 %31
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"[%lu, %lu]...\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @test(i8* nocapture %0, i8* %1, i32 %2, i64 %3, i32 %4) {
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = tail call i32 @prepare(i32 %4, i8* %7, i64 %3)
%9 = load i32, i32* @stderr
%10 = add i64 %6, %3
%11 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %2, i64 %10)
%12 = tail call i32 @system(i8* %0)
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret i32 %12
}