#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 */
typedef struct TYPE_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ atom;
  int /*<<< orphan*/ window;
};
struct TYPE_5__ {
  scalar_t__ type;
  TYPE_1__ xproperty;
};
typedef TYPE_2__ XEvent;
typedef int /*<<< orphan*/ Display;
typedef scalar_t__ Atom;

/* Variables and functions */
int /*<<< orphan*/ False;
scalar_t__ PropertyNotify;
scalar_t__ XA_CARDINAL;
int /*<<< orphan*/ XGetWindowProperty(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                      scalar_t__, int /*<<< orphan*/, int,
                                      int /*<<< orphan*/, scalar_t__,
                                      scalar_t__ *, int *, unsigned long *,
                                      unsigned long *, unsigned char **);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_2__ *);
int /*<<< orphan*/ printf(char *, ...);
void reply(Display *display, Atom _extents) {
  printf("  waiting for extents\n");
  while (1) {
    XEvent report;
    XNextEvent(display, &report);
    if (report.type == PropertyNotify && report.xproperty.atom == _extents) {
      Atom ret_type;
      int ret_format;
      unsigned long ret_items, ret_bytesleft;
      unsigned long *prop_return;
      XGetWindowProperty(display, report.xproperty.window, _extents, 0, 4,
                         False, XA_CARDINAL, &ret_type, &ret_format, &ret_items,
                         &ret_bytesleft, (unsigned char **)&prop_return);
      if (ret_type == XA_CARDINAL && ret_format == 32 && ret_items == 4)
        printf("  got new extents %d, %d, %d, %d\n", prop_return[0],
               prop_return[1], prop_return[2], prop_return[3]);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<reply>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1040 <XNextEvent@plt>
mov    -0x40(%rbp),%rax
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%rax
jne    123d <reply+0x10d>
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    123d <reply+0x10d>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    0x2e51(%rip),%rax
mov    (%rax),%r9d
mov    0x2e2f(%rip),%rax
mov    (%rax),%r15
lea    -0x68(%rbp),%rax
xor    %ecx,%ecx
mov    $0x4,%r8d
lea    -0x48(%rbp),%r14
lea    -0x4c(%rbp),%rbx
lea    -0x58(%rbp),%r11
lea    -0x60(%rbp),%r10
mov    %r15,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1050 <XGetWindowProperty@plt>
mov    -0x48(%rbp),%rax
mov    0x2de3(%rip),%rcx
cmp    (%rcx),%rax
jne    1238 <reply+0x108>
cmpl   $0x20,-0x4c(%rbp)
jne    1238 <reply+0x108>
cmpq   $0x4,-0x58(%rbp)
jne    1238 <reply+0x108>
mov    -0x68(%rbp),%rax
mov    (%rax),%rsi
mov    -0x68(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x68(%rbp),%rax
mov    0x10(%rax),%rcx
mov    -0x68(%rbp),%rax
mov    0x18(%rax),%r8
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <reply+0x112>
jmp    1156 <reply+0x26>
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<reply>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <XNextEvent@plt>
mov    0x2e65(%rip),%r15
jmp    118d <reply+0x4d>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <XNextEvent@plt>
mov    0x8(%rsp),%rax
cmp    (%r15),%rax
jne    1180 <reply+0x40>
cmp    %r14,0x10(%rsp)
jne    1180 <reply+0x40>
mov    0x18(%rsp),%esi
mov    0x2e3f(%rip),%rax
mov    (%rax),%r9d
mov    0x2e1d(%rip),%r15
lea    0x20(%rsp),%rax
lea    0x38(%rsp),%r10
lea    0x28(%rsp),%r11
lea    0x4(%rsp),%r12
lea    0x30(%rsp),%r13
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %ecx,%ecx
mov    $0x4,%r8d
push   %rax
push   %r10
push   %r11
push   %r12
push   %r13
push   (%r15)
call   1060 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x30(%rsp),%rax
cmp    (%r15),%rax
jne    122a <reply+0xea>
cmpl   $0x20,0x4(%rsp)
jne    122a <reply+0xea>
cmpq   $0x4,0x28(%rsp)
jne    122a <reply+0xea>
mov    0x20(%rsp),%rax
mov    (%rax),%rsi
mov    0x8(%rax),%rdx
mov    0x10(%rax),%rcx
mov    0x18(%rax),%r8
lea    0xddd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64, i32 }
@.str = [23 x i8] c" waiting for extents\0A\00"
@PropertyNotify = global i64 0
@False = global i32 0
@XA_CARDINAL = global i64 0
@.str.1 = [34 x i8] c" got new extents %d, %d, %d, %d\0A\00"
define void @reply(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca %struct.TYPE_5__
%6 = alloca i64
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64*
store i32* %0, i32** %3
store i64 %1, i64* %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %2, %59
%13 = load i32*, i32** %3
%14 = call i32 @XNextEvent(i32* %13, %struct.TYPE_5__* %5)
%15 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 0
%16 = load i64, i64* %15
%17 = load i64, i64* @PropertyNotify
%18 = icmp eq i64 %16, %17
br i1 %18, label %19, label %59
19: ; preds = %12
%20 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 1
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %20, i32 0, i32 0
%22 = load i64, i64* %21
%23 = load i64, i64* %4
%24 = icmp eq i64 %22, %23
br i1 %24, label %25, label %59
25: ; preds = %19
%26 = load i32*, i32** %3
%27 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 1
%28 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %27, i32 0, i32 1
%29 = load i32, i32* %28
%30 = load i64, i64* %4
%31 = load i32, i32* @False
%32 = load i64, i64* @XA_CARDINAL
%33 = bitcast i64** %10 to i8**
%34 = call i32 @XGetWindowProperty(i32* %26, i32 %29, i64 %30, i32 0, i32 4, i32 %31, i64 %32, i64* %6, i32* %7, i64* %8, i64* %9, i8** %33)
%35 = load i64, i64* %6
%36 = load i64, i64* @XA_CARDINAL
%37 = icmp eq i64 %35, %36
br i1 %37, label %38, label %58
38: ; preds = %25
%39 = load i32, i32* %7
%40 = icmp eq i32 %39, 32
br i1 %40, label %41, label %58
41: ; preds = %38
%42 = load i64, i64* %8
%43 = icmp eq i64 %42, 4
br i1 %43, label %44, label %58
44: ; preds = %41
%45 = load i64*, i64** %10
%46 = getelementptr inbounds i64, i64* %45, i64 0
%47 = load i64, i64* %46
%48 = load i64*, i64** %10
%49 = getelementptr inbounds i64, i64* %48, i64 1
%50 = load i64, i64* %49
%51 = load i64*, i64** %10
%52 = getelementptr inbounds i64, i64* %51, i64 2
%53 = load i64, i64* %52
%54 = load i64*, i64** %10
%55 = getelementptr inbounds i64, i64* %54, i64 3
%56 = load i64, i64* %55
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i64 %47, i64 %50, i64 %53, i64 %56)
br label %58
58: ; preds = %44, %41, %38, %25
br label %60
59: ; preds = %19, %12
br label %12
60: ; preds = %58
ret void
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64, i32 }
@PropertyNotify = global i64 0
@False = global i32 0
@XA_CARDINAL = global i64 0
@.str.1 = [34 x i8] c" got new extents %d, %d, %d, %d\0A\00"
@str = [22 x i8] c" waiting for extents\00"
define void @reply(i32* %0, i64 %1) {
%3 = alloca %struct.TYPE_5__
%4 = alloca i64
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%10 = bitcast %struct.TYPE_5__* %3 to i8*
%11 = call i32 @XNextEvent(i32* %0, %struct.TYPE_5__* %3)
%12 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 0
%13 = load i64, i64* %12
%14 = load i64, i64* @PropertyNotify
%15 = icmp eq i64 %13, %14
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 1, i32 0
%17 = load i64, i64* %16
%18 = icmp eq i64 %17, %1
%19 = select i1 %15, i1 %18, i1 false
br i1 %19, label %20, label %51
20: ; preds = %51, %2
%21 = bitcast i64* %4 to i8*
%22 = bitcast i32* %5 to i8*
%23 = bitcast i64* %6 to i8*
%24 = bitcast i64* %7 to i8*
%25 = bitcast i64** %8 to i8*
%26 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 1, i32 1
%27 = load i32, i32* %26
%28 = load i32, i32* @False
%29 = load i64, i64* @XA_CARDINAL
%30 = bitcast i64** %8 to i8**
%31 = call i32 @XGetWindowProperty(i32* %0, i32 %27, i64 %1, i32 0, i32 4, i32 %28, i64 %29, i64* %4, i32* %5, i64* %6, i64* %7, i8** %30)
%32 = load i64, i64* %4
%33 = load i64, i64* @XA_CARDINAL
%34 = icmp eq i64 %32, %33
%35 = load i32, i32* %5
%36 = icmp eq i32 %35, 32
%37 = select i1 %34, i1 %36, i1 false
%38 = load i64, i64* %6
%39 = icmp eq i64 %38, 4
%40 = select i1 %37, i1 %39, i1 false
br i1 %40, label %41, label %59
41: ; preds = %20
%42 = load i64*, i64** %8
%43 = load i64, i64* %42
%44 = getelementptr inbounds i64, i64* %42, i64 1
%45 = load i64, i64* %44
%46 = getelementptr inbounds i64, i64* %42, i64 2
%47 = load i64, i64* %46
%48 = getelementptr inbounds i64, i64* %42, i64 3
%49 = load i64, i64* %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i64 %43, i64 %45, i64 %47, i64 %49)
br label %59
51: ; preds = %2, %51
%52 = call i32 @XNextEvent(i32* %0, %struct.TYPE_5__* %3)
%53 = load i64, i64* %12
%54 = load i64, i64* @PropertyNotify
%55 = icmp eq i64 %53, %54
%56 = load i64, i64* %16
%57 = icmp eq i64 %56, %1
%58 = select i1 %55, i1 %57, i1 false
br i1 %58, label %20, label %51
59: ; preds = %20, %41
ret void
}