#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;
int cli(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show_usage(int);
int startup(char **, int *, int *);
int main(int argc, char **argv) {
  int msg_in, msg_out, ret = EXIT_FAILURE;
  if (argc < 3) {
    msg_in = 0xdead1;
    msg_out = 0xdead2;
  }
  printf("Starting OMNIUS command line interface\n");
  if ((ret = startup(argv, &msg_in, &msg_out)) != EXIT_SUCCESS) {
    show_usage(ret);
    exit(ret);
  }
  printf(" Connected... id(in=%d, out=%d)\n", msg_in, msg_out);
  ret = cli(msg_in, msg_out);
  printf("Terminating OMNIUS command line interface\n");
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e73(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    118a <main+0x3a>
movl   $0xdead1,-0x14(%rbp)
movl   $0xdead2,-0x18(%rbp)
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <startup@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e25(%rip),%rcx
cmp    (%rcx),%eax
je     11cb <main+0x7b>
mov    -0x1c(%rbp),%edi
call   1060 <show_usage@plt>
mov    -0x1c(%rbp),%edi
call   1070 <exit@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <cli@plt>
mov    %eax,-0x1c(%rbp)
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     117d <main+0x1d>
movl   $0xdead1,0xc(%rsp)
movl   $0xdead2,0x8(%rsp)
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1060 <startup@plt>
mov    %eax,%ebx
mov    0x2e3c(%rip),%rax
cmp    (%rax),%ebx
jne    11e1 <main+0x81>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <cli@plt>
mov    %eax,%ebx
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    %ebx,%edi
call   1070 <show_usage@plt>
mov    %ebx,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [40 x i8] c"Starting OMNIUS command line interface\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.1 = [33 x i8] c" Connected... id(in=%d, out=%d)\0A\00"
@.str.2 = [43 x i8] c"Terminating OMNIUS command line interface\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* @EXIT_FAILURE
store i32 %9, i32* %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 912081, i32* %6
store i32 912082, i32* %7
br label %13
13: ; preds = %12, %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%15 = load i8**, i8*** %5
%16 = call i32 @startup(i8** %15, i32* %6, i32* %7)
store i32 %16, i32* %8
%17 = load i32, i32* @EXIT_SUCCESS
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = load i32, i32* %8
%21 = call i32 @show_usage(i32 %20)
%22 = load i32, i32* %8
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %13
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %26)
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = call i32 @cli(i32 %28, i32 %29)
store i32 %30, i32* %8
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%32 = load i32, i32* %8
ret i32 %32
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@.str.1 = [33 x i8] c" Connected... id(in=%d, out=%d)\0A\00"
@str = [39 x i8] c"Starting OMNIUS command line interface\00"
@str.3 = [42 x i8] c"Terminating OMNIUS command line interface\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 912081, i32* %3
store i32 912082, i32* %4
br label %9
9: ; preds = %8, %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%11 = call i32 @startup(i8** %1, i32* %3, i32* %4)
%12 = load i32, i32* @EXIT_SUCCESS
%13 = icmp eq i32 %11, %12
br i1 %13, label %17, label %14
14: ; preds = %9
%15 = call i32 @show_usage(i32 %11)
%16 = call i32 @exit(i32 %11)
unreachable
17: ; preds = %9
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %19)
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = call i32 @cli(i32 %21, i32 %22)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.3, i64 0, i64 0))
ret i32 %23
}