#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 BadWindow;
int Success;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void check_status(int status, unsigned long window) {
  if (status == BadWindow) {
    printf("window id # 0x%lx does not exists!", window);
    exit(1);
  }
  if (status != Success) {
    printf("XGetWindowProperty failed!");
    exit(2);
  }
}


x86 assembly (clang, -O0):
<check_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ea7(%rip),%rcx
cmp    (%rcx),%eax
jne    115d <check_status+0x3d>
mov    -0x10(%rbp),%rsi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%eax
je     1187 <check_status+0x67>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_status>:
push   %rax
mov    0x2eb8(%rip),%rax
cmp    %edi,(%rax)
je     1139 <check_status+0x19>
mov    0x2ec5(%rip),%rax
cmp    %edi,(%rax)
jne    1151 <check_status+0x31>
pop    %rax
ret
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@BadWindow = global i32 0
@.str = [35 x i8] c"window id # 0x%lx does not exists!\00"
@Success = global i32 0
@.str.1 = [27 x i8] c"XGetWindowProperty failed!\00"
define void @check_status(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = load i32, i32* @BadWindow
%7 = icmp eq i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i64, i64* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i32, i32* %3
%14 = load i32, i32* @Success
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @exit(i32 2)
unreachable
19: ; preds = %12
ret void
}

LLVM IR (-O2):
@BadWindow = global i32 0
@.str = [35 x i8] c"window id # 0x%lx does not exists!\00"
@Success = global i32 0
@.str.1 = [27 x i8] c"XGetWindowProperty failed!\00"
define void @check_status(i32 %0, i64 %1) {
%3 = load i32, i32* @BadWindow
%4 = icmp eq i32 %3, %0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i64 %1)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = load i32, i32* @Success
%10 = icmp eq i32 %9, %0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @exit(i32 2)
unreachable
14: ; preds = %8
ret void
}