#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*/ addBytes(char *, int, char);
int /*<<< orphan*/ changeByte(char *, int, char);
int /*<<< orphan*/ checkFileSize(char *, char *, int);
int /*<<< orphan*/ cleanup();
int /*<<< orphan*/ createZeroFile(char *, int);
int /*<<< orphan*/ syncAndCheckMd4(char *, char *, char *, int,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ truncate(char *, int);
void testCycle(int sparseEnabled) {
  cleanup();
  createZeroFile("testSource.bin", 110000);
  syncAndCheckMd4("sync zero 1", "testSource.bin", "testDest.bin",
                  sparseEnabled, 0);
  checkFileSize("sync zero 1", "testSource.bin", 110000);
  changeByte("testSource.bin", 5, 'c');
  syncAndCheckMd4("one byte changed 1", "testSource.bin", "testDest.bin",
                  sparseEnabled, 0);
  checkFileSize("one byte changed 2", "testDest.bin", 110000);
  changeByte("testSource.bin", 80000, 'c');
  syncAndCheckMd4("one byte changed 1", "testSource.bin", "testDest.bin",
                  sparseEnabled, 0);
  checkFileSize("one byte changed 2", "testDest.bin", 110000);
  addBytes("testSource.bin", 3, 'c');
  syncAndCheckMd4("added 3 bytes 1", "testSource.bin", "testDest.bin",
                  sparseEnabled, 0);
  checkFileSize("added 3 bytes 2", "testDest.bin", 110003);
  addBytes("testSource.bin", 100001, 'c');
  syncAndCheckMd4("added 8 bytes 1", "testSource.bin", "testDest.bin",
                  sparseEnabled, 0);
  checkFileSize("added 8 bytes 2", "testDest.bin", 210004);
  truncate("testSource.bin", 123000);
  syncAndCheckMd4("truncated", "testSource.bin", "testDest.bin", sparseEnabled,
                  0);
  checkFileSize("truncated", "testDest.bin", 123000);
}


x86 assembly (clang, -O0):
<testCycle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1080 <cleanup@plt>
lea    0xe77(%rip),%rdi
mov    $0x1adb0,%esi
call   1060 <createZeroFile@plt>
mov    -0x4(%rbp),%ecx
lea    0xe72(%rip),%rdi
lea    0xe5c(%rip),%rsi
lea    0xe70(%rip),%rdx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
lea    0xe55(%rip),%rdi
lea    0xe3f(%rip),%rsi
mov    $0x1adb0,%edx
call   1030 <checkFileSize@plt>
lea    0xe2e(%rip),%rdi
mov    $0x5,%esi
mov    $0x63,%edx
call   1040 <changeByte@plt>
mov    -0x4(%rbp),%ecx
lea    0xe3d(%rip),%rdi
lea    0xe0e(%rip),%rsi
lea    0xe22(%rip),%rdx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
lea    0xe33(%rip),%rdi
lea    0xe0c(%rip),%rsi
mov    $0x1adb0,%edx
call   1030 <checkFileSize@plt>
lea    0xde0(%rip),%rdi
mov    $0x13880,%esi
mov    $0x63,%edx
call   1040 <changeByte@plt>
mov    -0x4(%rbp),%ecx
lea    0xdef(%rip),%rdi
lea    0xdc0(%rip),%rsi
lea    0xdd4(%rip),%rdx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
lea    0xde5(%rip),%rdi
lea    0xdbe(%rip),%rsi
mov    $0x1adb0,%edx
call   1030 <checkFileSize@plt>
lea    0xd92(%rip),%rdi
mov    $0x3,%esi
mov    $0x63,%edx
call   1090 <addBytes@plt>
mov    -0x4(%rbp),%ecx
lea    0xdc7(%rip),%rdi
lea    0xd72(%rip),%rsi
lea    0xd86(%rip),%rdx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
lea    0xdba(%rip),%rdi
lea    0xd70(%rip),%rsi
mov    $0x1adb3,%edx
call   1030 <checkFileSize@plt>
lea    0xd44(%rip),%rdi
mov    $0x186a1,%esi
mov    $0x63,%edx
call   1090 <addBytes@plt>
mov    -0x4(%rbp),%ecx
lea    0xd99(%rip),%rdi
lea    0xd24(%rip),%rsi
lea    0xd38(%rip),%rdx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
lea    0xd8c(%rip),%rdi
lea    0xd22(%rip),%rsi
mov    $0x33454,%edx
call   1030 <checkFileSize@plt>
lea    0xcf6(%rip),%rdi
mov    $0x1e078,%esi
call   1050 <truncate@plt>
mov    -0x4(%rbp),%ecx
lea    0xd70(%rip),%rdi
lea    0xcdb(%rip),%rsi
lea    0xcef(%rip),%rdx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
lea    0xd53(%rip),%rdi
lea    0xcd9(%rip),%rsi
mov    $0x1e078,%edx
call   1030 <checkFileSize@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testCycle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r13d
xor    %eax,%eax
call   1080 <cleanup@plt>
lea    0xe74(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1adb0,%esi
call   1060 <createZeroFile@plt>
lea    0xe6f(%rip),%r15
lea    0xe74(%rip),%r14
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r13d,%ecx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1adb0,%edx
call   1030 <checkFileSize@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x63,%edx
call   1040 <changeByte@plt>
lea    0xe44(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r13d,%ecx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
lea    0xe3c(%rip),%r12
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x1adb0,%edx
call   1030 <checkFileSize@plt>
mov    %rbx,%rdi
mov    $0x13880,%esi
mov    $0x63,%edx
call   1040 <changeByte@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r13d,%ecx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x1adb0,%edx
call   1030 <checkFileSize@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x63,%edx
call   1090 <addBytes@plt>
lea    0xdf0(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r13d,%ecx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
lea    0xde8(%rip),%rdi
mov    %r14,%rsi
mov    $0x1adb3,%edx
call   1030 <checkFileSize@plt>
mov    %rbx,%rdi
mov    $0x186a1,%esi
mov    $0x63,%edx
call   1090 <addBytes@plt>
lea    0xdd2(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r13d,%ecx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
lea    0xdca(%rip),%rdi
mov    %r14,%rsi
mov    $0x33454,%edx
call   1030 <checkFileSize@plt>
mov    %rbx,%rdi
mov    $0x1e078,%esi
call   1050 <truncate@plt>
lea    0xdb9(%rip),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r13d,%ecx
xor    %r8d,%r8d
call   1070 <syncAndCheckMd4@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x1e078,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <checkFileSize@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"testSource.bin\00"
@.str.1 = [12 x i8] c"sync zero 1\00"
@.str.2 = [13 x i8] c"testDest.bin\00"
@.str.3 = [19 x i8] c"one byte changed 1\00"
@.str.4 = [19 x i8] c"one byte changed 2\00"
@.str.5 = [16 x i8] c"added 3 bytes 1\00"
@.str.6 = [16 x i8] c"added 3 bytes 2\00"
@.str.7 = [16 x i8] c"added 8 bytes 1\00"
@.str.8 = [16 x i8] c"added 8 bytes 2\00"
@.str.9 = [10 x i8] c"truncated\00"
define void @testCycle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @cleanup()
%4 = call i32 @createZeroFile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 110000)
%5 = load i32, i32* %2
%6 = call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 0)
%7 = call i32 @checkFileSize(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 110000)
%8 = call i32 @changeByte(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 5, i8 signext 99)
%9 = load i32, i32* %2
%10 = call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 0)
%11 = call i32 @checkFileSize(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 110000)
%12 = call i32 @changeByte(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 80000, i8 signext 99)
%13 = load i32, i32* %2
%14 = call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 0)
%15 = call i32 @checkFileSize(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 110000)
%16 = call i32 @addBytes(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 3, i8 signext 99)
%17 = load i32, i32* %2
%18 = call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 0)
%19 = call i32 @checkFileSize(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 110003)
%20 = call i32 @addBytes(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 100001, i8 signext 99)
%21 = load i32, i32* %2
%22 = call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 0)
%23 = call i32 @checkFileSize(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 210004)
%24 = call i32 @truncate(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 123000)
%25 = load i32, i32* %2
%26 = call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 0)
%27 = call i32 @checkFileSize(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 123000)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"testSource.bin\00"
@.str.1 = [12 x i8] c"sync zero 1\00"
@.str.2 = [13 x i8] c"testDest.bin\00"
@.str.3 = [19 x i8] c"one byte changed 1\00"
@.str.4 = [19 x i8] c"one byte changed 2\00"
@.str.5 = [16 x i8] c"added 3 bytes 1\00"
@.str.6 = [16 x i8] c"added 3 bytes 2\00"
@.str.7 = [16 x i8] c"added 8 bytes 1\00"
@.str.8 = [16 x i8] c"added 8 bytes 2\00"
@.str.9 = [10 x i8] c"truncated\00"
define void @testCycle(i32 %0) {
%2 = tail call i32 (...) @cleanup()
%3 = tail call i32 @createZeroFile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 110000)
%4 = tail call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %0, i32 0)
%5 = tail call i32 @checkFileSize(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 110000)
%6 = tail call i32 @changeByte(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 5, i8 signext 99)
%7 = tail call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %0, i32 0)
%8 = tail call i32 @checkFileSize(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 110000)
%9 = tail call i32 @changeByte(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 80000, i8 signext 99)
%10 = tail call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %0, i32 0)
%11 = tail call i32 @checkFileSize(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 110000)
%12 = tail call i32 @addBytes(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 3, i8 signext 99)
%13 = tail call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %0, i32 0)
%14 = tail call i32 @checkFileSize(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 110003)
%15 = tail call i32 @addBytes(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 100001, i8 signext 99)
%16 = tail call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %0, i32 0)
%17 = tail call i32 @checkFileSize(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 210004)
%18 = tail call i32 @truncate(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 123000)
%19 = tail call i32 @syncAndCheckMd4(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %0, i32 0)
%20 = tail call i32 @checkFileSize(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 123000)
ret void
}