#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 */
typedef TYPE_2__ *WidgetClass;
typedef int /*<<< orphan*/ Widget;
struct TYPE_4__ {
  int /*<<< orphan*/ class_name;
  TYPE_2__ *superclass;
};
struct TYPE_5__ {
  TYPE_1__ core_class;
};
typedef int /*<<< orphan*/ Bool;

/* Variables and functions */
int /*<<< orphan*/ False;
int /*<<< orphan*/ True;
TYPE_2__ *XtClass(int /*<<< orphan*/);
int /*<<< orphan*/ XtIsTopLevelShell(int /*<<< orphan*/);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
Bool isApplicationShell(Widget w) {
  register WidgetClass c;
  if (!XtIsTopLevelShell(w))
    return (False);
  for (c = XtClass(w); c; c = c->core_class.superclass)
    if (strcmp(c->core_class.class_name, "ApplicationShell") == 0)
      return (True);
  return (False);
}


x86 assembly (clang, -O0):
<isApplicationShell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <XtIsTopLevelShell@plt>
cmp    $0x0,%eax
jne    115d <isApplicationShell+0x2d>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11c3 <isApplicationShell+0x93>
mov    -0x8(%rbp),%edi
call   1030 <XtClass@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11b7 <isApplicationShell+0x87>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a1 <isApplicationShell+0x71>
mov    0x2e49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11c3 <isApplicationShell+0x93>
jmp    11a6 <isApplicationShell+0x76>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x10(%rbp)
jmp    1169 <isApplicationShell+0x39>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isApplicationShell>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
call   1050 <XtIsTopLevelShell@plt>
mov    0x2ea2(%rip),%r15
test   %eax,%eax
je     118d <isApplicationShell+0x5d>
mov    %ebx,%edi
call   1030 <XtClass@plt>
test   %rax,%rax
je     118d <isApplicationShell+0x5d>
mov    %rax,%rbx
lea    0xea0(%rip),%r14
mov    0x2e79(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%edi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     118a <isApplicationShell+0x5a>
mov    0x8(%rbx),%rbx
test   %rbx,%rbx
jne    1170 <isApplicationShell+0x40>
jmp    118d <isApplicationShell+0x5d>
mov    %r12,%r15
mov    (%r15),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32, %struct.TYPE_5__* }
@False = global i32 0
@.str = [17 x i8] c"ApplicationShell\00"
@True = global i32 0
define i32 @isApplicationShell(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @XtIsTopLevelShell(i32 %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = load i32, i32* @False
store i32 %9, i32* %2
br label %33
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call %struct.TYPE_5__* @XtClass(i32 %11)
store %struct.TYPE_5__* %12, %struct.TYPE_5__** %4
br label %13
13: ; preds = %26, %10
%14 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%15 = icmp ne %struct.TYPE_5__* %14, null
br i1 %15, label %16, label %31
16: ; preds = %13
%17 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %17, i32 0, i32 0
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i32 0, i32 0
%20 = load i32, i32* %19
%21 = call i64 @strcmp(i32 %20, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = load i32, i32* @True
store i32 %24, i32* %2
br label %33
25: ; preds = %16
br label %26
26: ; preds = %25
%27 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%28 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %27, i32 0, i32 0
%29 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %28, i32 0, i32 1
%30 = load %struct.TYPE_5__*, %struct.TYPE_5__** %29
store %struct.TYPE_5__* %30, %struct.TYPE_5__** %4
br label %13
31: ; preds = %13
%32 = load i32, i32* @False
store i32 %32, i32* %2
br label %33
33: ; preds = %31, %23, %8
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32, %struct.TYPE_5__* }
@False = global i32 0
@.str = [17 x i8] c"ApplicationShell\00"
@True = global i32 0
define i32 @isApplicationShell(i32 %0) {
%2 = tail call i32 @XtIsTopLevelShell(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = tail call %struct.TYPE_5__* @XtClass(i32 %0)
%6 = icmp eq %struct.TYPE_5__* %5, null
br i1 %6, label %17, label %7
7: ; preds = %4, %13
%8 = phi %struct.TYPE_5__* [ %15, %13 ], [ %5, %4 ]
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i64 0, i32 0, i32 0
%10 = load i32, i32* %9
%11 = tail call i64 @strcmp(i32 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %7
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i64 0, i32 0, i32 1
%15 = load %struct.TYPE_5__*, %struct.TYPE_5__** %14
%16 = icmp eq %struct.TYPE_5__* %15, null
br i1 %16, label %17, label %7
17: ; preds = %7, %13, %4, %1
%18 = phi i32* [ @False, %1 ], [ @False, %4 ], [ @True, %7 ], [ @False, %13 ]
%19 = load i32, i32* %18
ret i32 %19
}