#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 */
struct LoadFileInfo {
  int dummy;
};
struct LoadDataInfo {
  int dummy;
};

/* Variables and functions */
scalar_t__ CallBack3(int, struct LoadDataInfo *, void *,
                     struct LoadFileInfo **);
int /*<<< orphan*/ CheckRunningInMainThread(char *);
int EndLoadIgorData(struct LoadDataInfo *ldiPtr, int refNum,
                    struct LoadFileInfo **topFIH) {
  if (!CheckRunningInMainThread("EndLoadIgorData"))
    return 978;
  return (int)CallBack3(155, ldiPtr, (void *)refNum, topFIH);
}


x86 assembly (clang, -O0):
<EndLoadIgorData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
lea    0xec6(%rip),%rdi
call   1040 <CheckRunningInMainThread@plt>
cmp    $0x0,%eax
jne    1154 <EndLoadIgorData+0x34>
movl   $0x3d2,-0x4(%rbp)
jmp    116d <EndLoadIgorData+0x4d>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x9b,%edi
call   1030 <CallBack3@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EndLoadIgorData>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xecd(%rip),%rdi
call   1040 <CheckRunningInMainThread@plt>
test   %eax,%eax
je     1151 <EndLoadIgorData+0x31>
movslq %ebp,%rdx
mov    $0x9b,%edi
mov    %rbx,%rsi
mov    %r14,%rcx
call   1030 <CallBack3@plt>
jmp    1156 <EndLoadIgorData+0x36>
mov    $0x3d2,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.LoadDataInfo = type { i32 }
%struct.LoadFileInfo = type { i32 }
@.str = [16 x i8] c"EndLoadIgorData\00"
define i32 @EndLoadIgorData(%struct.LoadDataInfo* %0, i32 %1, %struct.LoadFileInfo** %2) {
%4 = alloca i32
%5 = alloca %struct.LoadDataInfo*
%6 = alloca i32
%7 = alloca %struct.LoadFileInfo**
store %struct.LoadDataInfo* %0, %struct.LoadDataInfo** %5
store i32 %1, i32* %6
store %struct.LoadFileInfo** %2, %struct.LoadFileInfo*** %7
%8 = call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %3
store i32 978, i32* %4
br label %19
11: ; preds = %3
%12 = load %struct.LoadDataInfo*, %struct.LoadDataInfo** %5
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
%16 = load %struct.LoadFileInfo**, %struct.LoadFileInfo*** %7
%17 = call i64 @CallBack3(i32 155, %struct.LoadDataInfo* %12, i8* %15, %struct.LoadFileInfo** %16)
%18 = trunc i64 %17 to i32
store i32 %18, i32* %4
br label %19
19: ; preds = %11, %10
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
%struct.LoadDataInfo = type { i32 }
%struct.LoadFileInfo = type { i32 }
@.str = [16 x i8] c"EndLoadIgorData\00"
define i32 @EndLoadIgorData(%struct.LoadDataInfo* %0, i32 %1, %struct.LoadFileInfo** %2) {
%4 = tail call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = sext i32 %1 to i64
%8 = inttoptr i64 %7 to i8*
%9 = tail call i64 @CallBack3(i32 155, %struct.LoadDataInfo* %0, i8* %8, %struct.LoadFileInfo** %2)
%10 = trunc i64 %9 to i32
br label %11
11: ; preds = %3, %6
%12 = phi i32 [ %10, %6 ], [ 978, %3 ]
ret i32 %12
}