void mk_change(int *hexagram_2) {
  int cntr1;
  for (cntr1 = 0; cntr1 < 6; cntr1++) {
    if (*hexagram_2 == 0) {
      *hexagram_2 = 1;
    }
    if (*hexagram_2 == 3) {
      *hexagram_2 = 2;
    }
    hexagram_2++;
  }
  hexagram_2 -= 6;
}


x86 assembly (clang, -O0):
<mk_change>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    1161 <mk_change+0x61>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1130 <mk_change+0x30>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0x3,(%rax)
jne    1147 <mk_change+0x47>
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <mk_change+0xf>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffe8,%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mk_change>:
mov    (%rdi),%eax
test   %eax,%eax
je     1112 <mk_change+0x12>
cmp    $0x3,%eax
jne    1119 <mk_change+0x19>
mov    $0x2,%eax
jmp    1117 <mk_change+0x17>
mov    $0x1,%eax
mov    %eax,(%rdi)
mov    0x4(%rdi),%eax
cmp    $0x3,%eax
je     112c <mk_change+0x2c>
test   %eax,%eax
jne    1134 <mk_change+0x34>
mov    $0x1,%eax
jmp    1131 <mk_change+0x31>
mov    $0x2,%eax
mov    %eax,0x4(%rdi)
mov    0x8(%rdi),%eax
cmp    $0x3,%eax
je     1147 <mk_change+0x47>
test   %eax,%eax
jne    114f <mk_change+0x4f>
mov    $0x1,%eax
jmp    114c <mk_change+0x4c>
mov    $0x2,%eax
mov    %eax,0x8(%rdi)
mov    0xc(%rdi),%eax
cmp    $0x3,%eax
je     1162 <mk_change+0x62>
test   %eax,%eax
jne    116a <mk_change+0x6a>
mov    $0x1,%eax
jmp    1167 <mk_change+0x67>
mov    $0x2,%eax
mov    %eax,0xc(%rdi)
mov    0x10(%rdi),%eax
cmp    $0x3,%eax
je     117d <mk_change+0x7d>
test   %eax,%eax
jne    1185 <mk_change+0x85>
mov    $0x1,%eax
jmp    1182 <mk_change+0x82>
mov    $0x2,%eax
mov    %eax,0x10(%rdi)
mov    0x14(%rdi),%eax
cmp    $0x3,%eax
je     1198 <mk_change+0x98>
test   %eax,%eax
jne    11a0 <mk_change+0xa0>
mov    $0x1,%eax
jmp    119d <mk_change+0x9d>
mov    $0x2,%eax
mov    %eax,0x14(%rdi)
ret

LLVM IR (-O0):
define void @mk_change(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %22, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 6
br i1 %6, label %7, label %25
7: ; preds = %4
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = load i32*, i32** %2
store i32 1, i32* %12
br label %13
13: ; preds = %11, %7
%14 = load i32*, i32** %2
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 3
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load i32*, i32** %2
store i32 2, i32* %18
br label %19
19: ; preds = %17, %13
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i32 1
store i32* %21, i32** %2
br label %22
22: ; preds = %19
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %4
25: ; preds = %4
%26 = load i32*, i32** %2
%27 = getelementptr inbounds i32, i32* %26, i64 -6
store i32* %27, i32** %2
ret void
}

LLVM IR (-O2):
define void @mk_change(i32* nocapture %0) {
%2 = load i32, i32* %0
switch i32 %2, label %6 [
i32 0, label %4
i32 3, label %3
]
3: ; preds = %1
br label %4
4: ; preds = %1, %3
%5 = phi i32 [ 2, %3 ], [ 1, %1 ]
store i32 %5, i32* %0
br label %6
6: ; preds = %4, %1
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = load i32, i32* %7
switch i32 %8, label %12 [
i32 0, label %9
i32 3, label %10
]
9: ; preds = %6
br label %10
10: ; preds = %6, %9
%11 = phi i32 [ 1, %9 ], [ 2, %6 ]
store i32 %11, i32* %7
br label %12
12: ; preds = %10, %6
%13 = getelementptr inbounds i32, i32* %0, i64 2
%14 = load i32, i32* %13
switch i32 %14, label %18 [
i32 0, label %15
i32 3, label %16
]
15: ; preds = %12
br label %16
16: ; preds = %12, %15
%17 = phi i32 [ 1, %15 ], [ 2, %12 ]
store i32 %17, i32* %13
br label %18
18: ; preds = %16, %12
%19 = getelementptr inbounds i32, i32* %0, i64 3
%20 = load i32, i32* %19
switch i32 %20, label %24 [
i32 0, label %21
i32 3, label %22
]
21: ; preds = %18
br label %22
22: ; preds = %18, %21
%23 = phi i32 [ 1, %21 ], [ 2, %18 ]
store i32 %23, i32* %19
br label %24
24: ; preds = %22, %18
%25 = getelementptr inbounds i32, i32* %0, i64 4
%26 = load i32, i32* %25
switch i32 %26, label %30 [
i32 0, label %27
i32 3, label %28
]
27: ; preds = %24
br label %28
28: ; preds = %24, %27
%29 = phi i32 [ 1, %27 ], [ 2, %24 ]
store i32 %29, i32* %25
br label %30
30: ; preds = %28, %24
%31 = getelementptr inbounds i32, i32* %0, i64 5
%32 = load i32, i32* %31
switch i32 %32, label %36 [
i32 0, label %33
i32 3, label %34
]
33: ; preds = %30
br label %34
34: ; preds = %30, %33
%35 = phi i32 [ 1, %33 ], [ 2, %30 ]
store i32 %35, i32* %31
br label %36
36: ; preds = %34, %30
ret void
}