#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 /*<<< orphan*/ CheckRunningInMainThread(char *);
int /*<<< orphan*/ PutCmdLine(char const *, int);
void FinishDialogCmd(const char *cmd, int mode) {
  if (!CheckRunningInMainThread("FinishDialogCmd"))
    return;
  switch (mode) {
  case 1:
    PutCmdLine(cmd, 3);
    break;
  case 2:
    PutCmdLine(cmd, 1);
    break;
  case 3:
    break;
  }
}


x86 assembly (clang, -O0):
<FinishDialogCmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <CheckRunningInMainThread@plt>
cmp    $0x0,%eax
jne    1149 <FinishDialogCmd+0x29>
jmp    11aa <FinishDialogCmd+0x8a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     117f <FinishDialogCmd+0x5f>
jmp    115d <FinishDialogCmd+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1192 <FinishDialogCmd+0x72>
jmp    116e <FinishDialogCmd+0x4e>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     11a5 <FinishDialogCmd+0x85>
jmp    11aa <FinishDialogCmd+0x8a>
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1030 <PutCmdLine@plt>
jmp    11aa <FinishDialogCmd+0x8a>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <PutCmdLine@plt>
jmp    11aa <FinishDialogCmd+0x8a>
jmp    11aa <FinishDialogCmd+0x8a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FinishDialogCmd>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
call   1040 <CheckRunningInMainThread@plt>
test   %eax,%eax
je     1149 <FinishDialogCmd+0x29>
cmp    $0x1,%ebp
je     1150 <FinishDialogCmd+0x30>
cmp    $0x2,%ebp
jne    1149 <FinishDialogCmd+0x29>
mov    $0x1,%esi
jmp    1155 <FinishDialogCmd+0x35>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x3,%esi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <PutCmdLine@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"FinishDialogCmd\00"
define void @FinishDialogCmd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %2
br label %17
8: ; preds = %2
%9 = load i32, i32* %4
switch i32 %9, label %17 [
i32 1, label %10
i32 2, label %13
i32 3, label %16
]
10: ; preds = %8
%11 = load i8*, i8** %3
%12 = call i32 @PutCmdLine(i8* %11, i32 3)
br label %17
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i32 @PutCmdLine(i8* %14, i32 1)
br label %17
16: ; preds = %8
br label %17
17: ; preds = %7, %8, %16, %13, %10
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"FinishDialogCmd\00"
define void @FinishDialogCmd(i8* %0, i32 %1) {
%3 = tail call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2
switch i32 %1, label %10 [
i32 1, label %7
i32 2, label %6
]
6: ; preds = %5
br label %7
7: ; preds = %5, %6
%8 = phi i32 [ 1, %6 ], [ 3, %5 ]
%9 = tail call i32 @PutCmdLine(i8* %0, i32 %8)
br label %10
10: ; preds = %7, %2, %5
ret void
}