#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*/ printf(char *);
int scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char password[512];
  if (argc != 4) {
    printf("Not enough params");
    return -1;
  }
  if (scanf("%511s", password) != 1) {
    return -1;
  }
  if (strcmp(argv[2], "ruser")) {
    return -1;
  }
  if (strcmp(password, "password")) {
    return -1;
  }
  if (strcmp(argv[3], "rcommand")) {
    return -1;
  }
  if (strcmp(argv[1], "rhost")) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     116b <main+0x3b>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1241 <main+0x111>
lea    -0x210(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1193 <main+0x63>
movl   $0xffffffff,-0x4(%rbp)
jmp    1241 <main+0x111>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe76(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11bd <main+0x8d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1241 <main+0x111>
lea    -0x210(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11e6 <main+0xb6>
movl   $0xffffffff,-0x4(%rbp)
jmp    1241 <main+0x111>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe32(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1210 <main+0xe0>
movl   $0xffffffff,-0x4(%rbp)
jmp    1241 <main+0x111>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe11(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     123a <main+0x10a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1241 <main+0x111>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x208,%rsp
cmp    $0x4,%edi
jne    11b0 <main+0x80>
mov    %rsi,%r14
lea    0xec9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    $0xffffffff,%ebx
cmp    $0x1,%eax
jne    11c1 <main+0x91>
mov    0x10(%r14),%rdi
lea    0xeb2(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11c1 <main+0x91>
lea    0xea7(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11c1 <main+0x91>
mov    0x18(%r14),%rdi
lea    0xe98(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11c1 <main+0x91>
mov    0x8(%r14),%rdi
lea    0xe8c(%rip),%rsi
call   1040 <strcmp@plt>
neg    %rax
sbb    %ebx,%ebx
jmp    11c1 <main+0x91>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Not enough params\00"
@.str.1 = [6 x i8] c"%511s\00"
@.str.2 = [6 x i8] c"ruser\00"
@.str.3 = [9 x i8] c"password\00"
@.str.4 = [9 x i8] c"rcommand\00"
@.str.5 = [6 x i8] c"rhost\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [512 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %43
11: ; preds = %2
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 -1, i32* %3
br label %43
16: ; preds = %11
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 -1, i32* %3
br label %43
23: ; preds = %16
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 -1, i32* %3
br label %43
28: ; preds = %23
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %28
store i32 -1, i32* %3
br label %43
35: ; preds = %28
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %35
store i32 -1, i32* %3
br label %43
42: ; preds = %35
store i32 0, i32* %3
br label %43
43: ; preds = %42, %41, %34, %27, %22, %15, %9
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [18 x i8] c"Not enough params\00"
@.str.1 = [6 x i8] c"%511s\00"
@.str.2 = [6 x i8] c"ruser\00"
@.str.3 = [9 x i8] c"password\00"
@.str.4 = [9 x i8] c"rcommand\00"
@.str.5 = [6 x i8] c"rhost\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %30
8: ; preds = %2
%9 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %30
11: ; preds = %8
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %11
%17 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %19
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp ne i64 %27, 0
%29 = sext i1 %28 to i32
br label %30
30: ; preds = %24, %19, %16, %11, %8, %6
%31 = phi i32 [ -1, %6 ], [ -1, %8 ], [ -1, %11 ], [ -1, %16 ], [ -1, %19 ], [ %29, %24 ]
ret i32 %31
}