#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 atoi(char *);
int /*<<< orphan*/ printf(char *);
int start(int, int, int);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int total;
  int shmsz;
  int flags = 0;
  if ((argc < 3) || (argc > 4) || ((argc == 4) && strcmp(argv[1], "-r"))) {
    printf("Usage: hotspot [-r] [nodes] [shmsz]\n");
    return -1;
  }
  if (argc == 3) {
    total = atoi(argv[1]);
    shmsz = atoi(argv[2]);
  } else {
    total = atoi(argv[2]);
    shmsz = atoi(argv[3]);
    flags = 1;
  }
  return start(total, shmsz, flags);
}


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)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     1199 <main+0x59>
cmpl   $0x4,-0x8(%rbp)
jg     1199 <main+0x59>
cmpl   $0x4,-0x8(%rbp)
jne    11b1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe76(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11b1 <main+0x71>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1218 <main+0xd8>
cmpl   $0x3,-0x8(%rbp)
jne    11e0 <main+0xa0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1207 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1050 <start@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    -0x5(%rdi),%eax
cmp    $0xfffffffe,%eax
jae    116b <main+0x2b>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%rbx
cmp    $0x3,%edi
je     11a0 <main+0x60>
cmp    $0x4,%edi
jne    118d <main+0x4d>
mov    0x8(%rbx),%rdi
lea    0xe7d(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    114f <main+0xf>
mov    $0x1,%r14d
mov    $0x3,%r15d
mov    $0x2,%eax
jmp    11ae <main+0x6e>
xor    %r14d,%r14d
mov    $0x2,%r15d
mov    $0x1,%eax
mov    (%rbx,%rax,8),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    (%rbx,%r15,8),%rdi
call   1060 <atoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <start@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-r\00"
@.str.1 = [37 x i8] c"Usage: hotspot [-r] [nodes] [shmsz]\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
store i32 0, i32* %8
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %23, label %11
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 4
br i1 %13, label %23, label %14
14: ; preds = %11
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 4
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %17, %11, %2
%24 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %51
25: ; preds = %17, %14
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %6
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
store i32 %36, i32* %7
br label %46
37: ; preds = %25
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
store i32 %41, i32* %6
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 3
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %7
store i32 1, i32* %8
br label %46
46: ; preds = %37, %28
%47 = load i32, i32* %6
%48 = load i32, i32* %7
%49 = load i32, i32* %8
%50 = call i32 @start(i32 %47, i32 %48, i32 %49)
store i32 %50, i32* %3
br label %51
51: ; preds = %46, %23
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str = [3 x i8] c"-r\00"
@str = [36 x i8] c"Usage: hotspot [-r] [nodes] [shmsz]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -5
%4 = icmp ult i32 %3, -2
br i1 %4, label %11, label %5
5: ; preds = %2
switch i32 %0, label %13 [
i32 4, label %6
i32 3, label %14
]
6: ; preds = %5
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %6, %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %25
13: ; preds = %6, %5
br label %14
14: ; preds = %5, %13
%15 = phi i64 [ 2, %13 ], [ 1, %5 ]
%16 = phi i64 [ 3, %13 ], [ 2, %5 ]
%17 = phi i32 [ 1, %13 ], [ 0, %5 ]
%18 = getelementptr inbounds i8*, i8** %1, i64 %15
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 %16
%22 = load i8*, i8** %21
%23 = tail call i32 @atoi(i8* %22)
%24 = tail call i32 @start(i32 %20, i32 %23, i32 %17)
br label %25
25: ; preds = %14, %11
%26 = phi i32 [ -1, %11 ], [ %24, %14 ]
ret i32 %26
}