#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ netwCheck(char, char *, char *, char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ stopMonitor(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int checkExit(char c, char *string, char *stopmon, char *pidpath,
              char *netwstart, char *stdwlan, char *manag) {
  if (!strcmp(string, "0")) {
    fprintf(stdout, "Exiting...\n");
    stopMonitor(stopmon, pidpath);
    netwCheck(c, netwstart, stdwlan, manag);
    fprintf(stdout, "\nTerminated.\n\n");
    exit(EXIT_FAILURE);
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<checkExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    0x10(%rbp),%rdi
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11eb <checkExit+0x9b>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xe63(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <stopMonitor@plt>
mov    -0x1(%rbp),%al
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    0x10(%rbp),%rcx
movsbl %al,%edi
call   1050 <netwCheck@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
lea    0xe36(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2dde(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkExit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %rsi,%rax
mov    %edi,%r12d
lea    0xe8c(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1198 <checkExit+0x48>
mov    0x2e49(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e39(%rip),%r13
mov    0x0(%r13),%edi
lea    0xe58(%rip),%rsi
call   1040 <fprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1070 <stopMonitor@plt>
movsbl %r12b,%edi
mov    %r15,%rsi
mov    %r14,%rdx
mov    0x40(%rsp),%rcx
call   1050 <netwCheck@plt>
mov    0x0(%r13),%edi
lea    0xe35(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@stdout = global i32 0
@.str.1 = [12 x i8] c"Exiting...\0A\00"
@.str.2 = [15 x i8] c"\0ATerminated.\0A\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @checkExit(i8 signext %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
store i8 %0, i8* %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i8* %6, i8** %14
%15 = load i8*, i8** %9
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %33, label %18
18: ; preds = %7
%19 = load i32, i32* @stdout
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%21 = load i8*, i8** %10
%22 = load i8*, i8** %11
%23 = call i32 @stopMonitor(i8* %21, i8* %22)
%24 = load i8, i8* %8
%25 = load i8*, i8** %12
%26 = load i8*, i8** %13
%27 = load i8*, i8** %14
%28 = call i32 @netwCheck(i8 signext %24, i8* %25, i8* %26, i8* %27)
%29 = load i32, i32* @stdout
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%31 = load i32, i32* @EXIT_FAILURE
%32 = call i32 @exit(i32 %31)
unreachable
33: ; preds = %7
%34 = load i32, i32* @EXIT_SUCCESS
ret i32 %34
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@stdout = global i32 0
@.str.1 = [12 x i8] c"Exiting...\0A\00"
@.str.2 = [15 x i8] c"\0ATerminated.\0A\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @checkExit(i8 signext %0, i8* nocapture %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i32, i32* @stdout
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @stopMonitor(i8* %2, i8* %3)
%14 = tail call i32 @netwCheck(i8 signext %0, i8* %4, i8* %5, i8* %6)
%15 = load i32, i32* @stdout
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %7
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}