#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ print_usage(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int process_parameters(int argc, char **argv, char *reverse_mode) {
  *reverse_mode = 0;
  if (argc != 4) {
    fprintf(stderr, "Wrong number of parameters.\n\n");
    print_usage(stderr, argv[0]);
    return -1;
  }
  if (strcmp(argv[1], "--map-file") != 0 && strcmp(argv[1], "-m") != 0) {
    if (strcmp(argv[1], "-r") == 0) {
      *reverse_mode = 1;
    } else {
      fprintf(stderr, "Expecting \"--map-file\" parameter.\n\n");
      print_usage(stderr, argv[0]);
      return -1;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<process_parameters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
cmpl   $0x4,-0x8(%rbp)
je     118a <process_parameters+0x5a>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1050 <print_usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1232 <process_parameters+0x102>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe85(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     122b <process_parameters+0xfb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     122b <process_parameters+0xfb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe57(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11f0 <process_parameters+0xc0>
mov    -0x18(%rbp),%rax
movb   $0x1,(%rax)
jmp    1226 <process_parameters+0xf6>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1050 <print_usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1232 <process_parameters+0x102>
jmp    122b <process_parameters+0xfb>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_parameters>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
movb   $0x0,(%rdx)
cmp    $0x4,%edi
jne    1198 <process_parameters+0x68>
mov    %rdx,%rbx
mov    0x8(%r14),%rdi
lea    0xed1(%rip),%rsi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     11bc <process_parameters+0x8c>
mov    0x8(%r14),%rdi
lea    0xec2(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11bc <process_parameters+0x8c>
mov    0x8(%r14),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11c3 <process_parameters+0x93>
mov    0x2e53(%rip),%rbx
mov    (%rbx),%edi
lea    0xe99(%rip),%rsi
jmp    11a8 <process_parameters+0x78>
mov    0x2e41(%rip),%rbx
mov    (%rbx),%edi
lea    0xe58(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    (%r14),%rsi
call   1050 <print_usage@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
movb   $0x1,(%rbx)
jmp    11bc <process_parameters+0x8c>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"Wrong number of parameters.\0A\0A\00"
@.str.1 = [11 x i8] c"--map-file\00"
@.str.2 = [3 x i8] c"-m\00"
@.str.3 = [3 x i8] c"-r\00"
@.str.4 = [36 x i8] c"Expecting \22--map-file\22 parameter.\0A\0A\00"
define i32 @process_parameters(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %7
store i8 0, i8* %8
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 4
br i1 %10, label %11, label %19
11: ; preds = %3
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %6
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @print_usage(i32 %14, i8* %17)
store i32 -1, i32* %4
br label %49
19: ; preds = %3
%20 = load i8**, i8*** %6
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %48
25: ; preds = %19
%26 = load i8**, i8*** %6
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %48
31: ; preds = %25
%32 = load i8**, i8*** %6
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %31
%38 = load i8*, i8** %7
store i8 1, i8* %38
br label %47
39: ; preds = %31
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%42 = load i32, i32* @stderr
%43 = load i8**, i8*** %6
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = call i32 @print_usage(i32 %42, i8* %45)
store i32 -1, i32* %4
br label %49
47: ; preds = %37
br label %48
48: ; preds = %47, %25, %19
store i32 1, i32* %4
br label %49
49: ; preds = %48, %39, %11
%50 = load i32, i32* %4
ret i32 %50
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Wrong number of parameters.\0A\0A\00"
@.str.1 = [11 x i8] c"--map-file\00"
@.str.2 = [3 x i8] c"-m\00"
@.str.3 = [3 x i8] c"-r\00"
@.str.4 = [36 x i8] c"Expecting \22--map-file\22 parameter.\0A\0A\00"
define i32 @process_parameters(i32 %0, i8** nocapture %1, i8* nocapture writeonly %2) {
store i8 0, i8* %2
%4 = icmp eq i32 %0, 4
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %1
%10 = tail call i32 @print_usage(i32 %8, i8* %9)
br label %31
11: ; preds = %3
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %31, label %16
16: ; preds = %11
%17 = load i8*, i8** %12
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %16
%21 = load i8*, i8** %12
%22 = tail call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i8 1, i8* %2
br label %31
25: ; preds = %20
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %1
%30 = tail call i32 @print_usage(i32 %28, i8* %29)
br label %31
31: ; preds = %11, %16, %24, %25, %5
%32 = phi i32 [ -1, %5 ], [ -1, %25 ], [ 1, %24 ], [ 1, %16 ], [ 1, %11 ]
ret i32 %32
}