void buildMap(int *map, char **argv) {
  int count = 0;
  while (1) {
    if (argv[count] == '\0') {
      break;
    } else {
      if (strcmp(argv[count], ">") == 0) {
        map[count] = 1;
      } else if (strcmp(argv[count], ">>") == 0) {
        map[count] = 2;
      } else if (strcmp(argv[count], "|") == 0) {
        map[count] = 3;
      } else if (strcmp(argv[count], "<::") == 0) {
        map[count] = 4;
      } else if (strcmp(argv[count], "::>") == 0) {
        map[count] = 5;
      } else if (strcmp(argv[count], ":") == 0) {
        map[count] = 6;
      } else if (strcmp(argv[count], "&&") == 0) {
        map[count] = 7;
      }
    }
    count++;
  }
}


x86 assembly (clang, -O0):
<buildMap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    113f <buildMap+0x2f>
jmp    12de <buildMap+0x1ce>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xeb9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1174 <buildMap+0x64>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    12cb <buildMap+0x1bb>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe79(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a9 <buildMap+0x99>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x2,(%rax,%rcx,4)
jmp    12c6 <buildMap+0x1b6>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe47(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11de <buildMap+0xce>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x3,(%rax,%rcx,4)
jmp    12c1 <buildMap+0x1b1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe14(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1213 <buildMap+0x103>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x4,(%rax,%rcx,4)
jmp    12bc <buildMap+0x1ac>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xde3(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1248 <buildMap+0x138>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x5,(%rax,%rcx,4)
jmp    12b7 <buildMap+0x1a7>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdac(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    127d <buildMap+0x16d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x6,(%rax,%rcx,4)
jmp    12b2 <buildMap+0x1a2>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd7d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12ad <buildMap+0x19d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x7,(%rax,%rcx,4)
jmp    12b2 <buildMap+0x1a2>
jmp    12b7 <buildMap+0x1a7>
jmp    12bc <buildMap+0x1ac>
jmp    12c1 <buildMap+0x1b1>
jmp    12c6 <buildMap+0x1b6>
jmp    12cb <buildMap+0x1bb>
jmp    12d0 <buildMap+0x1c0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <buildMap+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildMap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%rsi),%rbp
test   %rbp,%rbp
je     1226 <buildMap+0x116>
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %r13d,%r13d
lea    0xed4(%rip),%r15
lea    0xec2(%rip),%r12
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11d0 <buildMap+0xc0>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11e0 <buildMap+0xd0>
mov    %rbp,%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11e7 <buildMap+0xd7>
mov    %rbp,%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ee <buildMap+0xde>
mov    %rbp,%rdi
lea    0xe73(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11f5 <buildMap+0xe5>
mov    %rbp,%rdi
lea    0xe5e(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11fc <buildMap+0xec>
mov    %rbp,%rdi
lea    0xe51(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1214 <buildMap+0x104>
mov    $0x7,%eax
jmp    1210 <buildMap+0x100>
nopl   0x0(%rax)
mov    $0x1,%eax
jmp    1210 <buildMap+0x100>
nopw   0x0(%rax,%rax,1)
mov    $0x2,%eax
jmp    1210 <buildMap+0x100>
mov    $0x3,%eax
jmp    1210 <buildMap+0x100>
mov    $0x4,%eax
jmp    1210 <buildMap+0x100>
mov    $0x5,%eax
jmp    1210 <buildMap+0x100>
mov    $0x6,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,(%r14,%r13,1)
mov    0x8(%rbx,%r13,2),%rbp
add    $0x4,%r13
test   %rbp,%rbp
jne    1140 <buildMap+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c">\00"
@.str.1 = [3 x i8] c">>\00"
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [4 x i8] c"<::\00"
@.str.4 = [4 x i8] c"::>\00"
@.str.5 = [2 x i8] c":\00"
@.str.6 = [3 x i8] c"&&\00"
define void @buildMap(i32* %0, i8** %1) {
%3 = alloca i32*
%4 = alloca i8**
%5 = alloca i32
store i32* %0, i32** %3
store i8** %1, i8*** %4
store i32 0, i32* %5
br label %6
6: ; preds = %2, %112
%7 = load i8**, i8*** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8*, i8** %7, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %6
br label %115
14: ; preds = %6
%15 = load i8**, i8*** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %14
%23 = load i32*, i32** %3
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 1, i32* %26
br label %111
27: ; preds = %14
%28 = load i8**, i8*** %4
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %27
%36 = load i32*, i32** %3
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
store i32 2, i32* %39
br label %110
40: ; preds = %27
%41 = load i8**, i8*** %4
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 @strcmp(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %40
%49 = load i32*, i32** %3
%50 = load i32, i32* %5
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
store i32 3, i32* %52
br label %109
53: ; preds = %40
%54 = load i8**, i8*** %4
%55 = load i32, i32* %5
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = call i32 @strcmp(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %66
61: ; preds = %53
%62 = load i32*, i32** %3
%63 = load i32, i32* %5
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i32, i32* %62, i64 %64
store i32 4, i32* %65
br label %108
66: ; preds = %53
%67 = load i8**, i8*** %4
%68 = load i32, i32* %5
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
%71 = load i8*, i8** %70
%72 = call i32 @strcmp(i8* %71, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %79
74: ; preds = %66
%75 = load i32*, i32** %3
%76 = load i32, i32* %5
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %75, i64 %77
store i32 5, i32* %78
br label %107
79: ; preds = %66
%80 = load i8**, i8*** %4
%81 = load i32, i32* %5
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8*, i8** %80, i64 %82
%84 = load i8*, i8** %83
%85 = call i32 @strcmp(i8* %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %92
87: ; preds = %79
%88 = load i32*, i32** %3
%89 = load i32, i32* %5
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %88, i64 %90
store i32 6, i32* %91
br label %106
92: ; preds = %79
%93 = load i8**, i8*** %4
%94 = load i32, i32* %5
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i8*, i8** %93, i64 %95
%97 = load i8*, i8** %96
%98 = call i32 @strcmp(i8* %97, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %105
100: ; preds = %92
%101 = load i32*, i32** %3
%102 = load i32, i32* %5
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i32, i32* %101, i64 %103
store i32 7, i32* %104
br label %105
105: ; preds = %100, %92
br label %106
106: ; preds = %105, %87
br label %107
107: ; preds = %106, %74
br label %108
108: ; preds = %107, %61
br label %109
109: ; preds = %108, %48
br label %110
110: ; preds = %109, %35
br label %111
111: ; preds = %110, %22
br label %112
112: ; preds = %111
%113 = load i32, i32* %5
%114 = add nsw i32 %113, 1
store i32 %114, i32* %5
br label %6
115: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c">\00"
@.str.1 = [3 x i8] c">>\00"
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [4 x i8] c"<::\00"
@.str.4 = [4 x i8] c"::>\00"
@.str.5 = [2 x i8] c":\00"
@.str.6 = [3 x i8] c"&&\00"
define void @buildMap(i32* nocapture writeonly %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %36, label %5
5: ; preds = %2, %31
%6 = phi i64 [ %32, %31 ], [ 0, %2 ]
%7 = phi i8* [ %34, %31 ], [ %3, %2 ]
%8 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %28, label %10
10: ; preds = %5
%11 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %28, label %13
13: ; preds = %10
%14 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %28, label %16
16: ; preds = %13
%17 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %28, label %19
19: ; preds = %16
%20 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %19
%23 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25, %22, %19, %16, %13, %10, %5
%29 = phi i32 [ 1, %5 ], [ 2, %10 ], [ 3, %13 ], [ 4, %16 ], [ 5, %19 ], [ 6, %22 ], [ 7, %25 ]
%30 = getelementptr inbounds i32, i32* %0, i64 %6
store i32 %29, i32* %30
br label %31
31: ; preds = %28, %25
%32 = add nuw i64 %6, 1
%33 = getelementptr inbounds i8*, i8** %1, i64 %32
%34 = load i8*, i8** %33
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %5
36: ; preds = %31, %2
ret void
}