#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, unsigned long,
                         int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void get_message_continue(FILE *fp1, FILE *fp2, unsigned long message_head_pos,
                          unsigned long delay) {
  fseek(fp2, message_head_pos, SEEK_SET);
  fseek(fp1, message_head_pos - delay, SEEK_SET);
  unsigned long cnt = 0;
  int zero_cnt = 0;
  char ch1, ch2, ch;
  while (1) {
    if (feof(fp1) || feof(fp2)) {
      printf("Message End!\n");
      return;
    }
    fread(&ch1, sizeof(char), 1, fp1);
    fread(&ch2, sizeof(char), 1, fp2);
    ch = ch1 ^ ch2;
    fwrite(&ch, 1, 1, stdout);
    cnt++;
  }
}


x86 assembly (clang, -O0):
<get_message_continue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x2e69(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
sub    -0x20(%rbp),%rsi
mov    0x2e4f(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%rax
jne    11cd <get_message_continue+0x7d>
mov    -0x10(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%rax
je     11df <get_message_continue+0x8f>
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%rcx
lea    -0x2d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    -0x10(%rbp),%rcx
lea    -0x2e(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movsbl -0x2d(%rbp),%eax
movsbl -0x2e(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0x2f(%rbp)
mov    0x2dbd(%rip),%rax
mov    (%rax),%ecx
lea    -0x2f(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1070 <fwrite@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11a7 <get_message_continue+0x57>

x86 assembly (clang, -O2):
<get_message_continue>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e72(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %rsi,%rdi
mov    %r12,%rsi
call   1060 <fseek@plt>
sub    %r15,%r12
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <fseek@plt>
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %rax,%rax
jne    1216 <get_message_continue+0xc6>
lea    0x7(%rsp),%r15
lea    0x6(%rsp),%r12
mov    0x2e2d(%rip),%rbp
lea    0x5(%rsp),%r13
mov    %r14,%rdi
call   1050 <feof@plt>
test   %rax,%rax
jne    1216 <get_message_continue+0xc6>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
movzbl 0x6(%rsp),%eax
xor    0x7(%rsp),%al
mov    %al,0x5(%rsp)
mov    0x0(%rbp),%ecx
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %rax,%rax
je     11b0 <get_message_continue+0x60>
lea    0xde3(%rip),%rdi
call   1030 <puts@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [14 x i8] c"Message End!\0A\00"
@stdout = global i32 0
define void @get_message_continue(i32* %0, i32* %1, i64 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
store i32* %0, i32** %5
store i32* %1, i32** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%14 = load i32*, i32** %6
%15 = load i64, i64* %7
%16 = load i32, i32* @SEEK_SET
%17 = call i32 @fseek(i32* %14, i64 %15, i32 %16)
%18 = load i32*, i32** %5
%19 = load i64, i64* %7
%20 = load i64, i64* %8
%21 = sub i64 %19, %20
%22 = load i32, i32* @SEEK_SET
%23 = call i32 @fseek(i32* %18, i64 %21, i32 %22)
store i64 0, i64* %9
store i32 0, i32* %10
br label %24
24: ; preds = %4, %34
%25 = load i32*, i32** %5
%26 = call i64 @feof(i32* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %24
%29 = load i32*, i32** %6
%30 = call i64 @feof(i32* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %28, %24
%33 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
34: ; preds = %28
%35 = load i32*, i32** %5
%36 = call i32 @fread(i8* %11, i32 1, i32 1, i32* %35)
%37 = load i32*, i32** %6
%38 = call i32 @fread(i8* %12, i32 1, i32 1, i32* %37)
%39 = load i8, i8* %11
%40 = sext i8 %39 to i32
%41 = load i8, i8* %12
%42 = sext i8 %41 to i32
%43 = xor i32 %40, %42
%44 = trunc i32 %43 to i8
store i8 %44, i8* %13
%45 = load i32, i32* @stdout
%46 = call i32 @fwrite(i8* %13, i32 1, i32 1, i32 %45)
%47 = load i64, i64* %9
%48 = add i64 %47, 1
store i64 %48, i64* %9
br label %24
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@stdout = global i32 0
@str = [13 x i8] c"Message End!\00"
define void @get_message_continue(i32* nocapture %0, i32* nocapture %1, i64 %2, i64 %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = load i32, i32* @SEEK_SET
%9 = tail call i32 @fseek(i32* %1, i64 %2, i32 %8)
%10 = sub i64 %2, %3
%11 = load i32, i32* @SEEK_SET
%12 = tail call i32 @fseek(i32* %0, i64 %10, i32 %11)
%13 = call i64 @feof(i32* %0)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %4, %20
%16 = call i64 @feof(i32* %1)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %20, %15, %4
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
20: ; preds = %15
%21 = call i32 @fread(i8* %5, i32 1, i32 1, i32* %0)
%22 = call i32 @fread(i8* %6, i32 1, i32 1, i32* %1)
%23 = load i8, i8* %5
%24 = load i8, i8* %6
%25 = xor i8 %24, %23
store i8 %25, i8* %7
%26 = load i32, i32* @stdout
%27 = call i32 @fwrite(i8* %7, i32 1, i32 1, i32 %26)
%28 = call i64 @feof(i32* %0)
%29 = icmp eq i64 %28, 0
br i1 %29, label %15, label %18
}