void next_commit_id_hw1(char *commit_id) {
  char *final = commit_id;
  int checker = 1;
  while (*commit_id != '\0') {
    switch (*commit_id) {
    case '0':
      if (checker == 0)
        *commit_id = 'c';
      else if (checker == 1) {
        *commit_id = '6';
        checker = 0;
      }
      break;
    case 'c':
      if (checker == 0)
        *commit_id = 'c';
      else if (checker == 1) {
        *commit_id = '6';
        checker = 0;
      }
      break;
    case '1':
      if (checker == 0)
        *commit_id = '1';
      else if (checker == 1) {
        *commit_id = '6';
        checker = 0;
      }
      break;
    case '6':
      if (checker == 0)
        *commit_id = '6';
      else if (checker == 1) {
        *commit_id = 'c';
        checker = 1;
      }
      break;
    default:
      break;
    }
    commit_id++;
  }
  commit_id = final;
}


x86 assembly (clang, -O0):
<next_commit_id_hw1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1268 <next_commit_id_hw1+0x168>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x18(%rbp)
sub    $0x30,%eax
je     1172 <next_commit_id_hw1+0x72>
jmp    113f <next_commit_id_hw1+0x3f>
mov    -0x18(%rbp),%eax
sub    $0x31,%eax
je     11e2 <next_commit_id_hw1+0xe2>
jmp    1150 <next_commit_id_hw1+0x50>
mov    -0x18(%rbp),%eax
sub    $0x36,%eax
je     121a <next_commit_id_hw1+0x11a>
jmp    1161 <next_commit_id_hw1+0x61>
mov    -0x18(%rbp),%eax
sub    $0x63,%eax
je     11aa <next_commit_id_hw1+0xaa>
jmp    1252 <next_commit_id_hw1+0x152>
cmpl   $0x0,-0x14(%rbp)
jne    1188 <next_commit_id_hw1+0x88>
mov    -0x8(%rbp),%rax
movb   $0x63,(%rax)
jmp    11a5 <next_commit_id_hw1+0xa5>
cmpl   $0x1,-0x14(%rbp)
jne    11a0 <next_commit_id_hw1+0xa0>
mov    -0x8(%rbp),%rax
movb   $0x36,(%rax)
movl   $0x0,-0x14(%rbp)
jmp    11a5 <next_commit_id_hw1+0xa5>
jmp    1257 <next_commit_id_hw1+0x157>
cmpl   $0x0,-0x14(%rbp)
jne    11c0 <next_commit_id_hw1+0xc0>
mov    -0x8(%rbp),%rax
movb   $0x63,(%rax)
jmp    11dd <next_commit_id_hw1+0xdd>
cmpl   $0x1,-0x14(%rbp)
jne    11d8 <next_commit_id_hw1+0xd8>
mov    -0x8(%rbp),%rax
movb   $0x36,(%rax)
movl   $0x0,-0x14(%rbp)
jmp    11dd <next_commit_id_hw1+0xdd>
jmp    1257 <next_commit_id_hw1+0x157>
cmpl   $0x0,-0x14(%rbp)
jne    11f8 <next_commit_id_hw1+0xf8>
mov    -0x8(%rbp),%rax
movb   $0x31,(%rax)
jmp    1215 <next_commit_id_hw1+0x115>
cmpl   $0x1,-0x14(%rbp)
jne    1210 <next_commit_id_hw1+0x110>
mov    -0x8(%rbp),%rax
movb   $0x36,(%rax)
movl   $0x0,-0x14(%rbp)
jmp    1215 <next_commit_id_hw1+0x115>
jmp    1257 <next_commit_id_hw1+0x157>
cmpl   $0x0,-0x14(%rbp)
jne    1230 <next_commit_id_hw1+0x130>
mov    -0x8(%rbp),%rax
movb   $0x36,(%rax)
jmp    124d <next_commit_id_hw1+0x14d>
cmpl   $0x1,-0x14(%rbp)
jne    1248 <next_commit_id_hw1+0x148>
mov    -0x8(%rbp),%rax
movb   $0x63,(%rax)
movl   $0x1,-0x14(%rbp)
jmp    124d <next_commit_id_hw1+0x14d>
jmp    1257 <next_commit_id_hw1+0x157>
jmp    1257 <next_commit_id_hw1+0x157>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1117 <next_commit_id_hw1+0x17>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_commit_id_hw1>:
mov    (%rdi),%cl
test   %cl,%cl
je     1184 <next_commit_id_hw1+0x84>
add    $0x1,%rdi
mov    $0x1,%edx
mov    $0x63,%eax
mov    $0x36,%r8d
jmp    113b <next_commit_id_hw1+0x3b>
nopl   0x0(%rax)
test   %edx,%edx
mov    $0x36,%esi
cmove  %eax,%esi
xor    %edx,%edx
mov    %sil,-0x1(%rdi)
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
je     1184 <next_commit_id_hw1+0x84>
movsbl %cl,%ecx
cmp    $0x35,%ecx
jg     1160 <next_commit_id_hw1+0x60>
cmp    $0x30,%ecx
je     1120 <next_commit_id_hw1+0x20>
cmp    $0x31,%ecx
jne    1130 <next_commit_id_hw1+0x30>
xor    %ecx,%ecx
test   %edx,%edx
setne  %cl
lea    (%rcx,%rcx,4),%esi
add    $0x31,%esi
jmp    112a <next_commit_id_hw1+0x2a>
nopl   0x0(%rax)
cmp    $0x36,%ecx
je     1170 <next_commit_id_hw1+0x70>
cmp    $0x63,%ecx
je     1120 <next_commit_id_hw1+0x20>
jmp    1130 <next_commit_id_hw1+0x30>
nopl   0x0(%rax)
xor    %ecx,%ecx
test   %edx,%edx
setne  %cl
mov    $0x63,%esi
cmove  %r8d,%esi
mov    %ecx,%edx
jmp    112c <next_commit_id_hw1+0x2c>
ret

LLVM IR (-O0):
define void @next_commit_id_hw1(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
store i32 1, i32* %4
br label %6
6: ; preds = %64, %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %67
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
switch i32 %14, label %63 [
i32 48, label %15
i32 99, label %27
i32 49, label %39
i32 54, label %51
]
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = load i8*, i8** %2
store i8 99, i8* %19
br label %26
20: ; preds = %15
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load i8*, i8** %2
store i8 54, i8* %24
store i32 0, i32* %4
br label %25
25: ; preds = %23, %20
br label %26
26: ; preds = %25, %18
br label %64
27: ; preds = %11
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = load i8*, i8** %2
store i8 99, i8* %31
br label %38
32: ; preds = %27
%33 = load i32, i32* %4
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = load i8*, i8** %2
store i8 54, i8* %36
store i32 0, i32* %4
br label %37
37: ; preds = %35, %32
br label %38
38: ; preds = %37, %30
br label %64
39: ; preds = %11
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = load i8*, i8** %2
store i8 49, i8* %43
br label %50
44: ; preds = %39
%45 = load i32, i32* %4
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = load i8*, i8** %2
store i8 54, i8* %48
store i32 0, i32* %4
br label %49
49: ; preds = %47, %44
br label %50
50: ; preds = %49, %42
br label %64
51: ; preds = %11
%52 = load i32, i32* %4
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = load i8*, i8** %2
store i8 54, i8* %55
br label %62
56: ; preds = %51
%57 = load i32, i32* %4
%58 = icmp eq i32 %57, 1
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = load i8*, i8** %2
store i8 99, i8* %60
store i32 1, i32* %4
br label %61
61: ; preds = %59, %56
br label %62
62: ; preds = %61, %54
br label %64
63: ; preds = %11
br label %64
64: ; preds = %63, %62, %50, %38, %26
%65 = load i8*, i8** %2
%66 = getelementptr inbounds i8, i8* %65, i32 1
store i8* %66, i8** %2
br label %6
67: ; preds = %6
%68 = load i8*, i8** %3
store i8* %68, i8** %2
ret void
}

LLVM IR (-O2):
define void @next_commit_id_hw1(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %31, label %4
4: ; preds = %1, %26
%5 = phi i8 [ %29, %26 ], [ %2, %1 ]
%6 = phi i32 [ %27, %26 ], [ 1, %1 ]
%7 = phi i8* [ %28, %26 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
switch i32 %8, label %26 [
i32 48, label %9
i32 99, label %12
i32 49, label %15
i32 54, label %18
]
9: ; preds = %4
%10 = icmp eq i32 %6, 0
%11 = select i1 %10, i8 99, i8 54
br label %23
12: ; preds = %4
%13 = icmp eq i32 %6, 0
%14 = select i1 %13, i8 99, i8 54
br label %23
15: ; preds = %4
%16 = icmp eq i32 %6, 0
%17 = select i1 %16, i8 49, i8 54
br label %23
18: ; preds = %4
%19 = icmp eq i32 %6, 0
%20 = select i1 %19, i8 54, i8 99
%21 = xor i1 %19, true
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %18, %15, %12, %9
%24 = phi i8 [ %11, %9 ], [ %14, %12 ], [ %17, %15 ], [ %20, %18 ]
%25 = phi i32 [ 0, %9 ], [ 0, %12 ], [ 0, %15 ], [ %22, %18 ]
store i8 %24, i8* %7
br label %26
26: ; preds = %23, %4
%27 = phi i32 [ %6, %4 ], [ %25, %23 ]
%28 = getelementptr inbounds i8, i8* %7, i64 1
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
br i1 %30, label %31, label %4
31: ; preds = %26, %1
ret void
}