#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_9__ TYPE_2__;
typedef struct TYPE_8__ TYPE_1__;

/* Type definitions */
typedef TYPE_2__ *Widget;
struct TYPE_8__ {
  int x;
  int y;
};
struct TYPE_9__ {
  TYPE_1__ core;
};

/* Variables and functions */
int /*<<< orphan*/ False;
int FindChildren(TYPE_2__ *, TYPE_2__ ***, int /*<<< orphan*/,
                 int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ PositionInChild(TYPE_2__ *, int, int);
int /*<<< orphan*/ True;
int /*<<< orphan*/ XtFree(char *);
Widget _FindChild(Widget parent, int x, int y) {
  Widget *children;
  int i = FindChildren(parent, &children, True, False, True);
  while (i > 0) {
    i--;
    if (PositionInChild(children[i], x, y)) {
      Widget child = children[i];
      XtFree((char *)children);
      return (_FindChild(child, x - child->core.x, y - child->core.y));
    }
  }
  XtFree((char *)children);
  return (parent);
}


x86 assembly (clang, -O0):
<_FindChild>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
mov    0x2e82(%rip),%rax
mov    (%rax),%ecx
mov    0x2e71(%rip),%rax
mov    (%rax),%r8d
lea    -0x20(%rbp),%rsi
call   1050 <FindChildren@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    11f5 <_FindChild+0xb5>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1060 <PositionInChild@plt>
cmp    $0x0,%rax
je     11f0 <_FindChild+0xb0>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <XtFree@plt>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x30(%rbp),%rax
sub    (%rax),%esi
mov    -0x18(%rbp),%edx
mov    -0x30(%rbp),%rax
sub    0x4(%rax),%edx
call   1040 <_FindChild@plt>
mov    %rax,-0x8(%rbp)
jmp    1206 <_FindChild+0xc6>
jmp    117e <_FindChild+0x3e>
mov    -0x20(%rbp),%rdi
call   1030 <XtFree@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_FindChild>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%r14
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    0x2e89(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rsi
mov    %edx,%r8d
call   1050 <FindChildren@plt>
mov    %eax,%ebx
xchg   %ax,%ax
test   %ebx,%ebx
jle    11b8 <_FindChild+0x78>
mov    (%rsp),%rax
mov    -0x8(%rax,%rbx,8),%rdi
add    $0xffffffffffffffff,%rbx
mov    %ebp,%esi
mov    %r15d,%edx
call   1060 <PositionInChild@plt>
test   %rax,%rax
je     1170 <_FindChild+0x30>
mov    %ebx,%eax
mov    (%rsp),%rdi
mov    (%rdi,%rax,8),%r14
call   1030 <XtFree@plt>
sub    (%r14),%ebp
sub    0x4(%r14),%r15d
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1040 <_FindChild@plt>
mov    %rax,%r14
jmp    11c1 <_FindChild+0x81>
mov    (%rsp),%rdi
call   1030 <XtFree@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_9__ = type { %struct.TYPE_8__ }
%struct.TYPE_8__ = type { i32, i32 }
@True = global i32 0
@False = global i32 0
define %struct.TYPE_9__* @_FindChild(%struct.TYPE_9__* %0, i32 %1, i32 %2) {
%4 = alloca %struct.TYPE_9__*
%5 = alloca %struct.TYPE_9__*
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.TYPE_9__**
%9 = alloca i32
%10 = alloca %struct.TYPE_9__*
store %struct.TYPE_9__* %0, %struct.TYPE_9__** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%11 = load %struct.TYPE_9__*, %struct.TYPE_9__** %5
%12 = load i32, i32* @True
%13 = load i32, i32* @False
%14 = load i32, i32* @True
%15 = call i32 @FindChildren(%struct.TYPE_9__* %11, %struct.TYPE_9__*** %8, i32 %12, i32 %13, i32 %14)
store i32 %15, i32* %9
br label %16
16: ; preds = %54, %3
%17 = load i32, i32* %9
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %55
19: ; preds = %16
%20 = load i32, i32* %9
%21 = add nsw i32 %20, -1
store i32 %21, i32* %9
%22 = load %struct.TYPE_9__**, %struct.TYPE_9__*** %8
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds %struct.TYPE_9__*, %struct.TYPE_9__** %22, i64 %24
%26 = load %struct.TYPE_9__*, %struct.TYPE_9__** %25
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = call i64 @PositionInChild(%struct.TYPE_9__* %26, i32 %27, i32 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %54
31: ; preds = %19
%32 = load %struct.TYPE_9__**, %struct.TYPE_9__*** %8
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds %struct.TYPE_9__*, %struct.TYPE_9__** %32, i64 %34
%36 = load %struct.TYPE_9__*, %struct.TYPE_9__** %35
store %struct.TYPE_9__* %36, %struct.TYPE_9__** %10
%37 = load %struct.TYPE_9__**, %struct.TYPE_9__*** %8
%38 = bitcast %struct.TYPE_9__** %37 to i8*
%39 = call i32 @XtFree(i8* %38)
%40 = load %struct.TYPE_9__*, %struct.TYPE_9__** %10
%41 = load i32, i32* %6
%42 = load %struct.TYPE_9__*, %struct.TYPE_9__** %10
%43 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %42, i32 0, i32 0
%44 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %43, i32 0, i32 0
%45 = load i32, i32* %44
%46 = sub nsw i32 %41, %45
%47 = load i32, i32* %7
%48 = load %struct.TYPE_9__*, %struct.TYPE_9__** %10
%49 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %48, i32 0, i32 0
%50 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %49, i32 0, i32 1
%51 = load i32, i32* %50
%52 = sub nsw i32 %47, %51
%53 = call %struct.TYPE_9__* @_FindChild(%struct.TYPE_9__* %40, i32 %46, i32 %52)
store %struct.TYPE_9__* %53, %struct.TYPE_9__** %4
br label %60
54: ; preds = %19
br label %16
55: ; preds = %16
%56 = load %struct.TYPE_9__**, %struct.TYPE_9__*** %8
%57 = bitcast %struct.TYPE_9__** %56 to i8*
%58 = call i32 @XtFree(i8* %57)
%59 = load %struct.TYPE_9__*, %struct.TYPE_9__** %5
store %struct.TYPE_9__* %59, %struct.TYPE_9__** %4
br label %60
60: ; preds = %55, %31
%61 = load %struct.TYPE_9__*, %struct.TYPE_9__** %4
ret %struct.TYPE_9__* %61
}

LLVM IR (-O2):
%struct.TYPE_9__ = type { %struct.TYPE_8__ }
%struct.TYPE_8__ = type { i32, i32 }
@True = global i32 0
@False = global i32 0
define %struct.TYPE_9__* @_FindChild(%struct.TYPE_9__* %0, i32 %1, i32 %2) {
%4 = alloca %struct.TYPE_9__**
%5 = bitcast %struct.TYPE_9__*** %4 to i8*
%6 = load i32, i32* @True
%7 = load i32, i32* @False
%8 = call i32 @FindChildren(%struct.TYPE_9__* %0, %struct.TYPE_9__*** %4, i32 %6, i32 %7, i32 %6)
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %14, %3
%11 = phi i64 [ %15, %14 ], [ %9, %3 ]
%12 = trunc i64 %11 to i32
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %35
14: ; preds = %10
%15 = add nsw i64 %11, -1
%16 = load %struct.TYPE_9__**, %struct.TYPE_9__*** %4
%17 = getelementptr inbounds %struct.TYPE_9__*, %struct.TYPE_9__** %16, i64 %15
%18 = load %struct.TYPE_9__*, %struct.TYPE_9__** %17
%19 = call i64 @PositionInChild(%struct.TYPE_9__* %18, i32 %1, i32 %2)
%20 = icmp eq i64 %19, 0
br i1 %20, label %10, label %21
21: ; preds = %14
%22 = and i64 %15, 4294967295
%23 = load %struct.TYPE_9__**, %struct.TYPE_9__*** %4
%24 = getelementptr inbounds %struct.TYPE_9__*, %struct.TYPE_9__** %23, i64 %22
%25 = load %struct.TYPE_9__*, %struct.TYPE_9__** %24
%26 = bitcast %struct.TYPE_9__** %23 to i8*
%27 = call i32 @XtFree(i8* %26)
%28 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %25, i64 0, i32 0, i32 0
%29 = load i32, i32* %28
%30 = sub nsw i32 %1, %29
%31 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %25, i64 0, i32 0, i32 1
%32 = load i32, i32* %31
%33 = sub nsw i32 %2, %32
%34 = call %struct.TYPE_9__* @_FindChild(%struct.TYPE_9__* %25, i32 %30, i32 %33)
br label %39
35: ; preds = %10
%36 = bitcast %struct.TYPE_9__*** %4 to i8**
%37 = load i8*, i8** %36
%38 = call i32 @XtFree(i8* %37)
br label %39
39: ; preds = %35, %21
%40 = phi %struct.TYPE_9__* [ %34, %21 ], [ %0, %35 ]
ret %struct.TYPE_9__* %40
}