#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*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void sync_error(FILE *fp, char *desc, int expect, int got) {
  fprintf(stderr, "\n%s\n", desc);
  fprintf(stderr, "At logfile offset %ld, expected '0x%x' got '0x%x'\n",
          ftell(fp), expect, got);
  fflush(stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<sync_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ftell@plt>
mov    -0x1c(%rbp),%edi
movslq %eax,%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<sync_error>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    0x2e85(%rip),%r12
mov    (%r12),%edi
lea    0xe9a(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%ebp
mov    %rbx,%rdi
call   1040 <ftell@plt>
movslq %eax,%rdx
lea    0xe82(%rip),%rsi
mov    %ebp,%edi
mov    %r15d,%ecx
mov    %r14d,%r8d
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
call   1050 <fflush@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [5 x i8] c"\0A%s\0A\00"
@.str.1 = [51 x i8] c"At logfile offset %ld, expected '0x%x' got '0x%x'\0A\00"
define void @sync_error(i32* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %6
%11 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @stderr
%13 = load i32*, i32** %5
%14 = call i32 @ftell(i32* %13)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %16, i32 %17, i32 %18)
%20 = load i32, i32* @stderr
%21 = call i32 @fflush(i32 %20)
%22 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"\0A%s\0A\00"
@.str.1 = [51 x i8] c"At logfile offset %ld, expected '0x%x' got '0x%x'\0A\00"
define void @sync_error(i32* nocapture %0, i8* %1, i32 %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = load i32, i32* @stderr
%8 = tail call i32 @ftell(i32* %0)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %10, i32 %2, i32 %3)
%12 = load i32, i32* @stderr
%13 = tail call i32 @fflush(i32 %12)
%14 = tail call i32 @exit(i32 1)
unreachable
}