#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 doPositionCommand(int, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcasecmp(char *, char *);
int processPositionCommand(int argc, char **argv) {
  int x = -99999;
  int y = -99999;
  int z = -99999;
  int i;
  for (i = 1; i < argc; i += 2) {
    if (strcasecmp(argv[i], "x") == 0)
      x = atoi(argv[i + 1]);
    else if (strcasecmp(argv[i], "y") == 0)
      y = atoi(argv[i + 1]);
    else if (strcasecmp(argv[i], "z") == 0)
      z = atoi(argv[i + 1]);
    else {
      fprintf(stderr, "Unknown position argument %s to DASA\n", argv[i]);
      return -1;
    }
  }
  return doPositionCommand(x, y, z);
}


x86 assembly (clang, -O0):
<processPositionCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xfffe7961,-0x14(%rbp)
movl   $0xfffe7961,-0x18(%rbp)
movl   $0xfffe7961,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1281 <processPositionCommand+0x141>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe76(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11b7 <processPositionCommand+0x77>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    126e <processPositionCommand+0x12e>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe38(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11f7 <processPositionCommand+0xb7>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1269 <processPositionCommand+0x129>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdfa(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1237 <processPositionCommand+0xf7>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1264 <processPositionCommand+0x124>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdb3(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1292 <processPositionCommand+0x152>
jmp    1269 <processPositionCommand+0x129>
jmp    126e <processPositionCommand+0x12e>
jmp    1273 <processPositionCommand+0x133>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
jmp    116b <processPositionCommand+0x2b>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1030 <doPositionCommand@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processPositionCommand>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0xfffe7961,%r12d
movl   $0xfffe7961,0x4(%rsp)
ff
mov    $0xfffe7961,%r15d
cmp    $0x2,%edi
jl     1210 <processPositionCommand+0xd0>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0xfffe7961,%r15d
mov    $0x1,%r14d
movl   $0xfffe7961,0x4(%rsp)
ff
mov    $0xfffe7961,%r12d
jmp    11a6 <processPositionCommand+0x66>
nopl   0x0(%rax)
mov    0x8(%rbx,%r14,8),%rdi
call   1060 <atoi@plt>
mov    %eax,%r12d
add    $0x2,%r14
cmp    %ebp,%r14d
jge    1210 <processPositionCommand+0xd0>
mov    (%rbx,%r14,8),%r13
mov    %r13,%rdi
lea    0xe4c(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     1190 <processPositionCommand+0x50>
mov    %r13,%rdi
lea    0xe3a(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     1200 <processPositionCommand+0xc0>
mov    %r13,%rdi
lea    0xe28(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
jne    122d <processPositionCommand+0xed>
mov    0x8(%rbx,%r14,8),%rdi
call   1060 <atoi@plt>
mov    %eax,%r15d
jmp    119d <processPositionCommand+0x5d>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rbx,%r14,8),%rdi
call   1060 <atoi@plt>
mov    %eax,0x4(%rsp)
jmp    119d <processPositionCommand+0x5d>
mov    %r12d,%edi
mov    0x4(%rsp),%esi
mov    %r15d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <doPositionCommand@plt>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
lea    0xdc9(%rip),%rsi
mov    %r13,%rdx
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"x\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [2 x i8] c"z\00"
@stderr = global i32 0
@.str.3 = [38 x i8] c"Unknown position argument %s to DASA\0A\00"
define i32 @processPositionCommand(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -99999, i32* %6
store i32 -99999, i32* %7
store i32 -99999, i32* %8
store i32 1, i32* %9
br label %10
10: ; preds = %73, %2
%11 = load i32, i32* %9
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %76
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i64 @strcasecmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %14
%23 = load i8**, i8*** %5
%24 = load i32, i32* %9
%25 = add nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %23, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %6
br label %72
30: ; preds = %14
%31 = load i8**, i8*** %5
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i64 @strcasecmp(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %46
38: ; preds = %30
%39 = load i8**, i8*** %5
%40 = load i32, i32* %9
%41 = add nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %39, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %7
br label %71
46: ; preds = %30
%47 = load i8**, i8*** %5
%48 = load i32, i32* %9
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i64 @strcasecmp(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %62
54: ; preds = %46
%55 = load i8**, i8*** %5
%56 = load i32, i32* %9
%57 = add nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8*, i8** %55, i64 %58
%60 = load i8*, i8** %59
%61 = call i32 @atoi(i8* %60)
store i32 %61, i32* %8
br label %70
62: ; preds = %46
%63 = load i32, i32* @stderr
%64 = load i8**, i8*** %5
%65 = load i32, i32* %9
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %68)
store i32 -1, i32* %3
br label %81
70: ; preds = %54
br label %71
71: ; preds = %70, %38
br label %72
72: ; preds = %71, %22
br label %73
73: ; preds = %72
%74 = load i32, i32* %9
%75 = add nsw i32 %74, 2
store i32 %75, i32* %9
br label %10
76: ; preds = %10
%77 = load i32, i32* %6
%78 = load i32, i32* %7
%79 = load i32, i32* %8
%80 = call i32 @doPositionCommand(i32 %77, i32 %78, i32 %79)
store i32 %80, i32* %3
br label %81
81: ; preds = %76, %62
%82 = load i32, i32* %3
ret i32 %82
}

LLVM IR (-O2):
@.str = [2 x i8] c"x\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [2 x i8] c"z\00"
@stderr = global i32 0
@.str.3 = [38 x i8] c"Unknown position argument %s to DASA\0A\00"
define i32 @processPositionCommand(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %44
4: ; preds = %2, %37
%5 = phi i64 [ %41, %37 ], [ 1, %2 ]
%6 = phi i32 [ %40, %37 ], [ -99999, %2 ]
%7 = phi i32 [ %39, %37 ], [ -99999, %2 ]
%8 = phi i32 [ %38, %37 ], [ -99999, %2 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %5
%10 = load i8*, i8** %9
%11 = tail call i64 @strcasecmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %4
%14 = add nuw nsw i64 %5, 1
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
br label %37
18: ; preds = %4
%19 = tail call i64 @strcasecmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = add nuw nsw i64 %5, 1
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
br label %37
26: ; preds = %18
%27 = tail call i64 @strcasecmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = add nuw nsw i64 %5, 1
%31 = getelementptr inbounds i8*, i8** %1, i64 %30
%32 = load i8*, i8** %31
%33 = tail call i32 @atoi(i8* %32)
br label %37
34: ; preds = %26
%35 = load i32, i32* @stderr
%36 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %49
37: ; preds = %13, %29, %21
%38 = phi i32 [ %17, %13 ], [ %8, %21 ], [ %8, %29 ]
%39 = phi i32 [ %7, %13 ], [ %25, %21 ], [ %7, %29 ]
%40 = phi i32 [ %6, %13 ], [ %6, %21 ], [ %33, %29 ]
%41 = add nuw i64 %5, 2
%42 = trunc i64 %41 to i32
%43 = icmp slt i32 %42, %0
br i1 %43, label %4, label %44
44: ; preds = %37, %2
%45 = phi i32 [ -99999, %2 ], [ %38, %37 ]
%46 = phi i32 [ -99999, %2 ], [ %39, %37 ]
%47 = phi i32 [ -99999, %2 ], [ %40, %37 ]
%48 = tail call i32 @doPositionCommand(i32 %45, i32 %46, i32 %47)
br label %49
49: ; preds = %44, %34
%50 = phi i32 [ -1, %34 ], [ %48, %44 ]
ret i32 %50
}