#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 _test_data_tls {
  int dummy;
};
struct _fixture_variant_tls {
  int dummy;
};
struct __test_metadata {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ chunked_sendfile(struct __test_metadata *,
                                    struct _test_data_tls *, int, int);
void tls_multi_chunk_sendfile(
    struct __test_metadata __attribute__((unused)) * _metadata,
    struct _test_data_tls __attribute__((unused)) * self,
    const struct _fixture_variant_tls __attribute__((unused)) * variant) {
  chunked_sendfile(_metadata, self, 4096, 4096);
  chunked_sendfile(_metadata, self, 4096, 0);
  chunked_sendfile(_metadata, self, 4096, 1);
  chunked_sendfile(_metadata, self, 4096, 2048);
  chunked_sendfile(_metadata, self, 8192, 2048);
  chunked_sendfile(_metadata, self, 4096, 8192);
  chunked_sendfile(_metadata, self, 8192, 4096);
  chunked_sendfile(_metadata, self, 12288, 1024);
  chunked_sendfile(_metadata, self, 12288, 2000);
  chunked_sendfile(_metadata, self, 15360, 100);
  chunked_sendfile(_metadata, self, 15360, 300);
  chunked_sendfile(_metadata, self, 1, 4096);
  chunked_sendfile(_metadata, self, 2048, 4096);
  chunked_sendfile(_metadata, self, 2048, 8192);
  chunked_sendfile(_metadata, self, 4096, 8192);
  chunked_sendfile(_metadata, self, 1024, 12288);
  chunked_sendfile(_metadata, self, 2000, 12288);
  chunked_sendfile(_metadata, self, 100, 15360);
  chunked_sendfile(_metadata, self, 300, 15360);
}


x86 assembly (clang, -O0):
<tls_multi_chunk_sendfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1000,%ecx
mov    %ecx,%edx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1000,%edx
mov    $0x1,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1000,%edx
mov    $0x800,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2000,%edx
mov    $0x800,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1000,%edx
mov    $0x2000,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2000,%edx
mov    $0x1000,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3000,%edx
mov    $0x400,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3000,%edx
mov    $0x7d0,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3c00,%edx
mov    $0x64,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3c00,%edx
mov    $0x12c,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
mov    $0x1000,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x800,%edx
mov    $0x1000,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x800,%edx
mov    $0x2000,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1000,%edx
mov    $0x2000,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x400,%edx
mov    $0x3000,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x7d0,%edx
mov    $0x3000,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x64,%edx
mov    $0x3c00,%ecx
call   1030 <chunked_sendfile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x12c,%edx
mov    $0x3c00,%ecx
call   1030 <chunked_sendfile@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tls_multi_chunk_sendfile>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x1000,%edx
mov    $0x1000,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1000,%edx
mov    $0x1,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1000,%edx
mov    $0x800,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2000,%edx
mov    $0x800,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1000,%edx
mov    $0x2000,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2000,%edx
mov    $0x1000,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3000,%edx
mov    $0x400,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3000,%edx
mov    $0x7d0,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3c00,%edx
mov    $0x64,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3c00,%edx
mov    $0x12c,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
mov    $0x1000,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x800,%edx
mov    $0x1000,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x800,%edx
mov    $0x2000,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1000,%edx
mov    $0x2000,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x400,%edx
mov    $0x3000,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x7d0,%edx
mov    $0x3000,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x64,%edx
mov    $0x3c00,%ecx
call   1030 <chunked_sendfile@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x12c,%edx
mov    $0x3c00,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <chunked_sendfile@plt>

LLVM IR (-O0):
%struct.__test_metadata = type { i32 }
%struct._test_data_tls = type { i32 }
%struct._fixture_variant_tls = type { i32 }
define void @tls_multi_chunk_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, %struct._fixture_variant_tls* %2) {
%4 = alloca %struct.__test_metadata*
%5 = alloca %struct._test_data_tls*
%6 = alloca %struct._fixture_variant_tls*
store %struct.__test_metadata* %0, %struct.__test_metadata** %4
store %struct._test_data_tls* %1, %struct._test_data_tls** %5
store %struct._fixture_variant_tls* %2, %struct._fixture_variant_tls** %6
%7 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%8 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%9 = call i32 @chunked_sendfile(%struct.__test_metadata* %7, %struct._test_data_tls* %8, i32 4096, i32 4096)
%10 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%11 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%12 = call i32 @chunked_sendfile(%struct.__test_metadata* %10, %struct._test_data_tls* %11, i32 4096, i32 0)
%13 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%14 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%15 = call i32 @chunked_sendfile(%struct.__test_metadata* %13, %struct._test_data_tls* %14, i32 4096, i32 1)
%16 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%17 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%18 = call i32 @chunked_sendfile(%struct.__test_metadata* %16, %struct._test_data_tls* %17, i32 4096, i32 2048)
%19 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%20 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%21 = call i32 @chunked_sendfile(%struct.__test_metadata* %19, %struct._test_data_tls* %20, i32 8192, i32 2048)
%22 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%23 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%24 = call i32 @chunked_sendfile(%struct.__test_metadata* %22, %struct._test_data_tls* %23, i32 4096, i32 8192)
%25 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%26 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%27 = call i32 @chunked_sendfile(%struct.__test_metadata* %25, %struct._test_data_tls* %26, i32 8192, i32 4096)
%28 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%29 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%30 = call i32 @chunked_sendfile(%struct.__test_metadata* %28, %struct._test_data_tls* %29, i32 12288, i32 1024)
%31 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%32 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%33 = call i32 @chunked_sendfile(%struct.__test_metadata* %31, %struct._test_data_tls* %32, i32 12288, i32 2000)
%34 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%35 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%36 = call i32 @chunked_sendfile(%struct.__test_metadata* %34, %struct._test_data_tls* %35, i32 15360, i32 100)
%37 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%38 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%39 = call i32 @chunked_sendfile(%struct.__test_metadata* %37, %struct._test_data_tls* %38, i32 15360, i32 300)
%40 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%41 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%42 = call i32 @chunked_sendfile(%struct.__test_metadata* %40, %struct._test_data_tls* %41, i32 1, i32 4096)
%43 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%44 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%45 = call i32 @chunked_sendfile(%struct.__test_metadata* %43, %struct._test_data_tls* %44, i32 2048, i32 4096)
%46 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%47 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%48 = call i32 @chunked_sendfile(%struct.__test_metadata* %46, %struct._test_data_tls* %47, i32 2048, i32 8192)
%49 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%50 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%51 = call i32 @chunked_sendfile(%struct.__test_metadata* %49, %struct._test_data_tls* %50, i32 4096, i32 8192)
%52 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%53 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%54 = call i32 @chunked_sendfile(%struct.__test_metadata* %52, %struct._test_data_tls* %53, i32 1024, i32 12288)
%55 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%56 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%57 = call i32 @chunked_sendfile(%struct.__test_metadata* %55, %struct._test_data_tls* %56, i32 2000, i32 12288)
%58 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%59 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%60 = call i32 @chunked_sendfile(%struct.__test_metadata* %58, %struct._test_data_tls* %59, i32 100, i32 15360)
%61 = load %struct.__test_metadata*, %struct.__test_metadata** %4
%62 = load %struct._test_data_tls*, %struct._test_data_tls** %5
%63 = call i32 @chunked_sendfile(%struct.__test_metadata* %61, %struct._test_data_tls* %62, i32 300, i32 15360)
ret void
}

LLVM IR (-O2):
%struct.__test_metadata = type { i32 }
%struct._test_data_tls = type { i32 }
%struct._fixture_variant_tls = type { i32 }
define void @tls_multi_chunk_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, %struct._fixture_variant_tls* nocapture readnone %2) {
%4 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 4096, i32 4096)
%5 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 4096, i32 0)
%6 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 4096, i32 1)
%7 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 4096, i32 2048)
%8 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 8192, i32 2048)
%9 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 4096, i32 8192)
%10 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 8192, i32 4096)
%11 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 12288, i32 1024)
%12 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 12288, i32 2000)
%13 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 15360, i32 100)
%14 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 15360, i32 300)
%15 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 1, i32 4096)
%16 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 2048, i32 4096)
%17 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 2048, i32 8192)
%18 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 4096, i32 8192)
%19 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 1024, i32 12288)
%20 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 2000, i32 12288)
%21 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 100, i32 15360)
%22 = tail call i32 @chunked_sendfile(%struct.__test_metadata* %0, %struct._test_data_tls* %1, i32 300, i32 15360)
ret void
}