void c2_write_ar(struct c2interface *c2if, unsigned char addr) {
  int i;
  c2d_set(c2if, 1);
  c2ck_strobe(c2if);
  c2d_set(c2if, 1);
  c2ck_strobe(c2if);
  c2d_set(c2if, 1);
  c2ck_strobe(c2if);
  for (i = 0; i < 8; i++) {
    c2d_set(c2if, addr & 0x01);
    c2ck_strobe(c2if);
    addr >>= 1;
  }
  c2d_set(c2if, 1);
  c2ck_strobe(c2if);
  printf("%s: 0x%02X\n", __func__, addr);
}


x86 assembly (clang, -O0):
<c2_write_ar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <c2d_set@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <c2ck_strobe@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <c2d_set@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <c2ck_strobe@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <c2d_set@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <c2ck_strobe@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    11d9 <c2_write_ar+0xa9>
mov    -0x8(%rbp),%rdi
movzbl -0x9(%rbp),%esi
and    $0x1,%esi
mov    $0x0,%al
call   1040 <c2d_set@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <c2ck_strobe@plt>
movzbl -0x9(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x9(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119a <c2_write_ar+0x6a>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <c2d_set@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <c2ck_strobe@plt>
movzbl -0x9(%rbp),%edx
lea    0xe01(%rip),%rdi
lea    0xe06(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c2_write_ar>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %ebp,%esi
and    $0x1,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %ebp,%eax
shr    %al
and    $0x1,%al
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %ebp,%eax
shr    $0x2,%al
and    $0x1,%al
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %ebp,%eax
shr    $0x3,%al
and    $0x1,%al
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %ebp,%eax
shr    $0x4,%al
and    $0x1,%al
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %ebp,%eax
shr    $0x5,%al
and    $0x1,%al
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %ebp,%eax
shr    $0x6,%al
and    $0x1,%al
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
shr    $0x7,%bpl
movzbl %bpl,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <c2d_set@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <c2ck_strobe@plt>
lea    0xd78(%rip),%rdi
lea    0xd7d(%rip),%rsi
xor    %edx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.c2interface = type opaque
@.str = [12 x i8] c"%s: 0x%02X\0A\00"
@__func__.c2_write_ar = [12 x i8] c"c2_write_ar\00"
define void @c2_write_ar(%struct.c2interface* %0, i8 zeroext %1) {
%3 = alloca %struct.c2interface*
%4 = alloca i8
%5 = alloca i32
store %struct.c2interface* %0, %struct.c2interface** %3
store i8 %1, i8* %4
%6 = load %struct.c2interface*, %struct.c2interface** %3
%7 = call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %6, i32 1)
%8 = load %struct.c2interface*, %struct.c2interface** %3
%9 = call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %8)
%10 = load %struct.c2interface*, %struct.c2interface** %3
%11 = call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %10, i32 1)
%12 = load %struct.c2interface*, %struct.c2interface** %3
%13 = call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %12)
%14 = load %struct.c2interface*, %struct.c2interface** %3
%15 = call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %14, i32 1)
%16 = load %struct.c2interface*, %struct.c2interface** %3
%17 = call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %16)
store i32 0, i32* %5
br label %18
18: ; preds = %33, %2
%19 = load i32, i32* %5
%20 = icmp slt i32 %19, 8
br i1 %20, label %21, label %36
21: ; preds = %18
%22 = load %struct.c2interface*, %struct.c2interface** %3
%23 = load i8, i8* %4
%24 = zext i8 %23 to i32
%25 = and i32 %24, 1
%26 = call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %22, i32 %25)
%27 = load %struct.c2interface*, %struct.c2interface** %3
%28 = call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %27)
%29 = load i8, i8* %4
%30 = zext i8 %29 to i32
%31 = ashr i32 %30, 1
%32 = trunc i32 %31 to i8
store i8 %32, i8* %4
br label %33
33: ; preds = %21
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %18
36: ; preds = %18
%37 = load %struct.c2interface*, %struct.c2interface** %3
%38 = call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %37, i32 1)
%39 = load %struct.c2interface*, %struct.c2interface** %3
%40 = call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %39)
%41 = load i8, i8* %4
%42 = zext i8 %41 to i32
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.c2_write_ar, i64 0, i64 0), i32 %42)
ret void
}

LLVM IR (-O2):
%struct.c2interface = type opaque
@.str = [12 x i8] c"%s: 0x%02X\0A\00"
@__func__.c2_write_ar = [12 x i8] c"c2_write_ar\00"
define void @c2_write_ar(%struct.c2interface* %0, i8 zeroext %1) {
%3 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 1)
%4 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%5 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 1)
%6 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%7 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 1)
%8 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%9 = and i8 %1, 1
%10 = zext i8 %9 to i32
%11 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 %10)
%12 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%13 = lshr i8 %1, 1
%14 = and i8 %13, 1
%15 = zext i8 %14 to i32
%16 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 %15)
%17 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%18 = lshr i8 %1, 2
%19 = and i8 %18, 1
%20 = zext i8 %19 to i32
%21 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 %20)
%22 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%23 = lshr i8 %1, 3
%24 = and i8 %23, 1
%25 = zext i8 %24 to i32
%26 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 %25)
%27 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%28 = lshr i8 %1, 4
%29 = and i8 %28, 1
%30 = zext i8 %29 to i32
%31 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 %30)
%32 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%33 = lshr i8 %1, 5
%34 = and i8 %33, 1
%35 = zext i8 %34 to i32
%36 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 %35)
%37 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%38 = lshr i8 %1, 6
%39 = and i8 %38, 1
%40 = zext i8 %39 to i32
%41 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 %40)
%42 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%43 = lshr i8 %1, 7
%44 = zext i8 %43 to i32
%45 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 %44)
%46 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%47 = tail call i32 (%struct.c2interface*, i32, ...) bitcast (i32 (...)* @c2d_set to i32 (%struct.c2interface*, i32, ...)*)(%struct.c2interface* %0, i32 1)
%48 = tail call i32 (%struct.c2interface*, ...) bitcast (i32 (...)* @c2ck_strobe to i32 (%struct.c2interface*, ...)*)(%struct.c2interface* %0)
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.c2_write_ar, i64 0, i64 0), i32 0)
ret void
}