#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*/ errexit(char *, int);
int /*<<< orphan*/ printf(char *, int, int);
int read_word();
int /*<<< orphan*/ write_word(int);
void client_reconnecting(void) {
  int val;
  write_word(0x4843);
  val = read_word();
  if (val != 0x0380) {
    printf("\nServer's Debug info: expected $%04x, received $%04x\n", 0x0380,
           val);
    write_word(0x0a00);
    errexit("Client uses different revision of PARCP communication protocol.",
            105);
  }
  write_word(0x0105);
}


x86 assembly (clang, -O0):
<client_reconnecting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4843,%edi
call   1060 <write_word@plt>
mov    $0x0,%al
call   1050 <read_word@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x380,-0x4(%rbp)
je     1198 <client_reconnecting+0x58>
mov    -0x4(%rbp),%edx
lea    0xe8d(%rip),%rdi
mov    $0x380,%esi
call   1030 <printf@plt>
mov    $0xa00,%edi
call   1060 <write_word@plt>
lea    0xea8(%rip),%rdi
mov    $0x69,%esi
call   1040 <errexit@plt>
mov    $0x105,%edi
call   1060 <write_word@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client_reconnecting>:
push   %rax
mov    $0x4843,%edi
call   1060 <write_word@plt>
xor    %eax,%eax
call   1050 <read_word@plt>
cmp    $0x380,%eax
je     1187 <client_reconnecting+0x47>
lea    0xea0(%rip),%rdi
mov    $0x380,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xa00,%edi
call   1060 <write_word@plt>
lea    0xeb9(%rip),%rdi
mov    $0x69,%esi
call   1040 <errexit@plt>
mov    $0x105,%edi
pop    %rax
jmp    1060 <write_word@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"\0AServer's Debug info: expected $%04x, received $%04x\0A\00"
@.str.1 = [64 x i8] c"Client uses different revision of PARCP communication protocol.\00"
define void @client_reconnecting() {
%1 = alloca i32
%2 = call i32 @write_word(i32 18499)
%3 = call i32 (...) @read_word()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 896
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 896, i32 %7)
%9 = call i32 @write_word(i32 2560)
%10 = call i32 @errexit(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 105)
br label %11
11: ; preds = %6, %0
%12 = call i32 @write_word(i32 261)
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"\0AServer's Debug info: expected $%04x, received $%04x\0A\00"
@.str.1 = [64 x i8] c"Client uses different revision of PARCP communication protocol.\00"
define void @client_reconnecting() {
%1 = tail call i32 @write_word(i32 18499)
%2 = tail call i32 (...) @read_word()
%3 = icmp eq i32 %2, 896
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 896, i32 %2)
%6 = tail call i32 @write_word(i32 2560)
%7 = tail call i32 @errexit(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 105)
br label %8
8: ; preds = %4, %0
%9 = tail call i32 @write_word(i32 261)
ret void
}