#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 EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ command_thread_create();
int /*<<< orphan*/ command_thread_join();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (argc == 0) {
    printf("Error: Required arguments are not specified\n");
    printf("Usage: scmd 0.0.0.0 3600\n");
    return EXIT_FAILURE;
  }
  if (command_thread_create() == 0) {
    command_thread_join();
  } else {
    printf("Error: Cannot create CommandThread\n");
    return EXIT_FAILURE;
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1179 <main+0x49>
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11bf <main+0x8f>
mov    $0x0,%al
call   1050 <command_thread_create@plt>
cmp    $0x0,%rax
jne    1196 <main+0x66>
mov    $0x0,%al
call   1030 <command_thread_join@plt>
jmp    11b3 <main+0x83>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11bf <main+0x8f>
mov    0x2e1e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
test   %edi,%edi
je     114a <main+0x1a>
xor    %eax,%eax
call   1050 <command_thread_create@plt>
test   %rax,%rax
je     116b <main+0x3b>
lea    0xeb8(%rip),%rdi
jmp    115d <main+0x2d>
lea    0xed2(%rip),%rdi
call   1040 <puts@plt>
lea    0xef2(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e77(%rip),%rax
jmp    1179 <main+0x49>
xor    %eax,%eax
call   1030 <command_thread_join@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Error: Required arguments are not specified\0A\00"
@.str.1 = [26 x i8] c"Usage: scmd 0.0.0.0 3600\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [36 x i8] c"Error: Cannot create CommandThread\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
store i32 %11, i32* %3
br label %22
12: ; preds = %2
%13 = call i64 (...) @command_thread_create()
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (...) @command_thread_join()
br label %20
17: ; preds = %12
%18 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
store i32 %19, i32* %3
br label %22
20: ; preds = %15
%21 = load i32, i32* @EXIT_SUCCESS
store i32 %21, i32* %3
br label %22
22: ; preds = %20, %17, %8
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [35 x i8] c"Error: Cannot create CommandThread\00"
@str.3 = [44 x i8] c"Error: Required arguments are not specified\00"
@str.4 = [25 x i8] c"Usage: scmd 0.0.0.0 3600\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.3, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
br label %14
7: ; preds = %2
%8 = tail call i64 (...) @command_thread_create()
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 (...) @command_thread_join()
br label %14
12: ; preds = %7
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %10, %12, %4
%15 = phi i32* [ @EXIT_FAILURE, %4 ], [ @EXIT_SUCCESS, %10 ], [ @EXIT_FAILURE, %12 ]
%16 = load i32, i32* %15
ret i32 %16
}