void tb() {
  int h, e, b, len;
  char *exp;
  char buf[128];
  printf("SMBus / I2C tests.");
  h = i2c_open(1, 0x53, 0);
  CHECK(11, 1, h, 0, 0, "i2c open");
  e = i2c_write_device(h, "\x00", 1);
  CHECK(11, 2, e, 0, 0, "i2c write device");
  b = i2c_read_device(h, buf, 1);
  CHECK(11, 3, b, 1, 0, "i2c read device");
  CHECK(11, 4, buf[0], 0xE5, 0, "i2c read device");
  b = i2c_read_byte(h);
  CHECK(11, 5, b, 0xE5, 0, "i2c read byte");
  b = i2c_read_byte_data(h, 0);
  CHECK(11, 6, b, 0xE5, 0, "i2c read byte data");
  b = i2c_read_byte_data(h, 48);
  CHECK(11, 7, b, 2, 0, "i2c read byte data");
  exp = "\x1D[aBcDeFgHjKM]";
  len = strlen(exp);
  e = i2c_write_device(h, exp, len);
  CHECK(11, 8, e, 0, 0, "i2c write device");
  e = i2c_write_device(h, "\x1D", 1);
  b = i2c_read_device(h, buf, len - 1);
  CHECK(11, 9, b, len - 1, 0, "i2c read device");
  CHECK(11, 10, strncmp(buf, exp + 1, len - 1), 0, 0, "i2c read device");
  if (strncmp(buf, exp + 1, len - 1))
    printf("got [%.*s] expected [%.*s]\n", len - 1, buf, len - 1, exp + 1);
  e = i2c_write_byte_data(h, 0x1d, 0xAA);
  CHECK(11, 11, e, 0, 0, "i2c write byte data");
  b = i2c_read_byte_data(h, 0x1d);
  CHECK(11, 12, b, 0xAA, 0, "i2c read byte data");
  e = i2c_write_byte_data(h, 0x1d, 0x55);
  CHECK(11, 13, e, 0, 0, "i2c write byte data");
  b = i2c_read_byte_data(h, 0x1d);
  CHECK(11, 14, b, 0x55, 0, "i2c read byte data");
  exp = "[1234567890#]";
  len = strlen(exp);
  e = i2c_write_block_data(h, 0x1C, exp, len);
  CHECK(11, 15, e, 0, 0, "i2c write block data");
  e = i2c_write_device(h, "\x1D", 1);
  b = i2c_read_device(h, buf, len);
  CHECK(11, 16, b, len, 0, "i2c read device");
  CHECK(11, 17, strncmp(buf, exp, len), 0, 0, "i2c read device");
  if (strncmp(buf, exp, len))
    printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
  b = i2c_read_i2c_block_data(h, 0x1D, buf, len);
  CHECK(11, 18, b, len, 0, "i2c read i2c block data");
  CHECK(11, 19, strncmp(buf, exp, len), 0, 0, "i2c read i2c block data");
  if (strncmp(buf, exp, len))
    printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
  exp = "(-+=;:,<>!%)";
  len = strlen(exp);
  e = i2c_write_i2c_block_data(h, 0x1D, exp, len);
  CHECK(11, 20, e, 0, 0, "i2c write i2c block data");
  b = i2c_read_i2c_block_data(h, 0x1D, buf, len);
  CHECK(11, 21, b, len, 0, "i2c read i2c block data");
  CHECK(11, 22, strncmp(buf, exp, len), 0, 0, "i2c read i2c block data");
  if (strncmp(buf, exp, len))
    printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
  e = i2c_close(h);
  CHECK(11, 23, e, 0, 0, "i2c close");
}


x86 assembly (clang, -O0):
<tb>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
mov    $0x53,%esi
xor    %edx,%edx
mov    $0x0,%al
call   10a0 <i2c_open@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0xb,%edi
mov    $0x1,%esi
xor    %r8d,%r8d
lea    0xded(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
lea    0xed0(%rip),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   10b0 <i2c_write_device@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xb,%edi
mov    $0x2,%esi
xor    %r8d,%r8d
lea    0xdbc(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1060 <i2c_read_device@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xb,%edi
mov    $0x3,%esi
mov    $0x1,%ecx
xor    %r8d,%r8d
lea    0xd8e(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
movsbl -0xa0(%rbp),%edx
mov    $0xb,%edi
mov    $0x4,%esi
mov    $0xe5,%ecx
xor    %r8d,%r8d
lea    0xd67(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   10e0 <i2c_read_byte@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xb,%edi
mov    $0x5,%esi
mov    $0xe5,%ecx
xor    %r8d,%r8d
lea    0xd47(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
mov    $0x0,%al
call   10c0 <i2c_read_byte_data@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xb,%edi
mov    $0x6,%esi
mov    $0xe5,%ecx
xor    %r8d,%r8d
lea    0xd23(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x30,%esi
mov    $0x0,%al
call   10c0 <i2c_read_byte_data@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xb,%edi
mov    $0x7,%esi
mov    $0x2,%ecx
xor    %r8d,%r8d
lea    0xcee(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    0xcf3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%edx
mov    $0x0,%al
call   10b0 <i2c_write_device@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xb,%edi
mov    $0x8,%esi
xor    %r8d,%r8d
lea    0xc76(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
lea    0xcb3(%rip),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   10b0 <i2c_write_device@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
mov    $0x0,%al
call   1060 <i2c_read_device@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
mov    $0xb,%edi
mov    $0x9,%esi
xor    %r8d,%r8d
lea    0xc2d(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdx
call   1040 <strncmp@plt>
mov    %eax,%edx
mov    $0xb,%edi
mov    $0xa,%esi
xor    %r8d,%r8d
lea    0xbf3(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
je     1493 <tb+0x2b3>
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
lea    -0xa0(%rbp),%rdx
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%r8
add    $0x1,%r8
lea    0xbe3(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x1d,%esi
mov    $0xaa,%edx
mov    $0x0,%al
call   1050 <i2c_write_byte_data@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xb,%esi
xor    %r8d,%r8d
lea    0xbcf(%rip),%r9
mov    %esi,%edi
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x1d,%esi
mov    $0x0,%al
call   10c0 <i2c_read_byte_data@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xb,%edi
mov    $0xc,%esi
mov    $0xaa,%ecx
xor    %r8d,%r8d
lea    0xb55(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x1d,%esi
mov    $0x55,%edx
mov    $0x0,%al
call   1050 <i2c_write_byte_data@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xb,%edi
mov    $0xd,%esi
xor    %r8d,%r8d
lea    0xb60(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x1d,%esi
mov    $0x0,%al
call   10c0 <i2c_read_byte_data@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xb,%edi
mov    $0xe,%esi
mov    $0x55,%ecx
xor    %r8d,%r8d
lea    0xae8(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    0xb2e(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    $0x1c,%esi
mov    $0x0,%al
call   1100 <i2c_write_block_data@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xb,%edi
mov    $0xf,%esi
xor    %r8d,%r8d
lea    0xafc(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
lea    0xaa8(%rip),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   10b0 <i2c_write_device@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    -0x10(%rbp),%edx
mov    $0x0,%al
call   1060 <i2c_read_device@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0xb,%edi
mov    $0x10,%esi
xor    %r8d,%r8d
lea    0xa28(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x10(%rbp),%rdx
call   1040 <strncmp@plt>
mov    %eax,%edx
mov    $0xb,%edi
mov    $0x11,%esi
xor    %r8d,%r8d
lea    0x9f7(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x10(%rbp),%rdx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
je     167c <tb+0x49c>
mov    -0x10(%rbp),%esi
lea    -0xa0(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0x9fa(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    $0x1d,%esi
mov    $0x0,%al
call   1090 <i2c_read_i2c_block_data@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0xb,%edi
mov    $0x12,%esi
xor    %r8d,%r8d
lea    0xa10(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x10(%rbp),%rdx
call   1040 <strncmp@plt>
mov    %eax,%edx
mov    $0xb,%edi
mov    $0x13,%esi
xor    %r8d,%r8d
lea    0x9df(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x10(%rbp),%rdx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
je     1729 <tb+0x549>
mov    -0x10(%rbp),%esi
lea    -0xa0(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0x94d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    0x9aa(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    $0x1d,%esi
mov    $0x0,%al
call   10d0 <i2c_write_i2c_block_data@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xb,%edi
mov    $0x14,%esi
xor    %r8d,%r8d
lea    0x977(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    $0x1d,%esi
mov    $0x0,%al
call   1090 <i2c_read_i2c_block_data@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0xb,%edi
mov    $0x15,%esi
xor    %r8d,%r8d
lea    0x912(%rip),%r9
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x10(%rbp),%rdx
call   1040 <strncmp@plt>
mov    %eax,%edx
mov    $0xb,%edi
mov    $0x16,%esi
xor    %r8d,%r8d
lea    0x8e1(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x10(%rbp),%rdx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
je     1827 <tb+0x647>
mov    -0x10(%rbp),%esi
lea    -0xa0(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0x84f(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   10f0 <i2c_close@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xb,%edi
mov    $0x17,%esi
xor    %r8d,%r8d
lea    0x8b5(%rip),%r9
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <CHECK@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xe18(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x53,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1090 <i2c_open@plt>
mov    %eax,%ebx
lea    0xe08(%rip),%r9
mov    $0xb,%edi
mov    $0x1,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1030 <CHECK@plt>
lea    0xee0(%rip),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   10a0 <i2c_write_device@plt>
lea    0xddd(%rip),%r12
mov    $0xb,%edi
mov    $0x2,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r12,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    %rsp,%r15
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1060 <i2c_read_device@plt>
lea    0xdb8(%rip),%r14
mov    $0xb,%edi
mov    $0x3,%esi
mov    %eax,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
movsbl (%rsp),%edx
mov    $0xb,%edi
mov    $0x4,%esi
mov    $0xe5,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   10d0 <i2c_read_byte@plt>
lea    0xd7a(%rip),%r9
mov    $0xb,%edi
mov    $0x5,%esi
mov    %eax,%edx
mov    $0xe5,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %eax,%eax
call   10b0 <i2c_read_byte_data@plt>
lea    0xd5b(%rip),%r13
mov    $0xb,%edi
mov    $0x6,%esi
mov    %eax,%edx
mov    $0xe5,%ecx
xor    %r8d,%r8d
mov    %r13,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    %ebx,%edi
mov    $0x30,%esi
xor    %eax,%eax
call   10b0 <i2c_read_byte_data@plt>
mov    $0xb,%edi
mov    $0x7,%esi
mov    %eax,%edx
mov    $0x2,%ecx
xor    %r8d,%r8d
mov    %r13,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
lea    0xd1d(%rip),%rsi
mov    %ebx,%edi
mov    $0xe,%edx
xor    %eax,%eax
call   10a0 <i2c_write_device@plt>
mov    $0xb,%edi
mov    $0x8,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r12,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
lea    0xcfc(%rip),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   10a0 <i2c_write_device@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0xd,%edx
xor    %eax,%eax
call   1060 <i2c_read_device@plt>
mov    $0xb,%edi
mov    $0x9,%esi
mov    %eax,%edx
mov    $0xd,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
lea    0xcaa(%rip),%rsi
mov    $0xd,%edx
mov    %r15,%rdi
call   1040 <strncmp@plt>
mov    $0xb,%edi
mov    $0xa,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
movabs $0x674665446342615b,%rax
65 46 67
xor    (%rsp),%rax
movabs $0x5d4d4b6a48674665,%rcx
4b 4d 5d
xor    0x5(%rsp),%rcx
or     %rax,%rcx
je     1421 <tb+0x251>
lea    0xc69(%rip),%rdi
lea    0xc52(%rip),%r8
mov    %rsp,%rdx
mov    $0xd,%esi
mov    $0xd,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
movabs $0x5d23303938373635,%r13
30 23 5d
movabs $0x373635343332315b,%rbp
35 36 37
mov    %ebx,%edi
mov    $0x1d,%esi
mov    $0xaa,%edx
xor    %eax,%eax
call   1050 <i2c_write_byte_data@plt>
lea    0xc3c(%rip),%r14
mov    $0xb,%edi
mov    $0xb,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    %ebx,%edi
mov    $0x1d,%esi
xor    %eax,%eax
call   10b0 <i2c_read_byte_data@plt>
lea    0xbcc(%rip),%r15
mov    $0xb,%edi
mov    $0xc,%esi
mov    %eax,%edx
mov    $0xaa,%ecx
xor    %r8d,%r8d
mov    %r15,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    %ebx,%edi
mov    $0x1d,%esi
mov    $0x55,%edx
xor    %eax,%eax
call   1050 <i2c_write_byte_data@plt>
mov    $0xb,%edi
mov    $0xd,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    %ebx,%edi
mov    $0x1d,%esi
xor    %eax,%eax
call   10b0 <i2c_read_byte_data@plt>
mov    $0xb,%edi
mov    $0xe,%esi
mov    %eax,%edx
mov    $0x55,%ecx
xor    %r8d,%r8d
mov    %r15,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
lea    0xba1(%rip),%r14
mov    %ebx,%edi
mov    $0x1c,%esi
mov    %r14,%rdx
mov    $0xd,%ecx
xor    %eax,%eax
call   10f0 <i2c_write_block_data@plt>
lea    0xb92(%rip),%r9
mov    $0xb,%edi
mov    $0xf,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1030 <CHECK@plt>
lea    0xb33(%rip),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   10a0 <i2c_write_device@plt>
mov    %rsp,%r15
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0xd,%edx
xor    %eax,%eax
call   1060 <i2c_read_device@plt>
lea    0xaca(%rip),%r12
mov    $0xb,%edi
mov    $0x10,%esi
mov    %eax,%edx
mov    $0xd,%ecx
xor    %r8d,%r8d
mov    %r12,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    $0xd,%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strncmp@plt>
mov    $0xb,%edi
mov    $0x11,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r12,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    (%rsp),%rax
xor    %rbp,%rax
mov    0x5(%rsp),%rcx
xor    %r13,%rcx
or     %rax,%rcx
je     15e2 <tb+0x412>
lea    0xaa8(%rip),%rdi
lea    0xad1(%rip),%r8
mov    %rsp,%rdx
mov    $0xd,%esi
mov    $0xd,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rsp,%r14
mov    %ebx,%edi
mov    $0x1d,%esi
mov    %r14,%rdx
mov    $0xd,%ecx
xor    %eax,%eax
call   1080 <i2c_read_i2c_block_data@plt>
lea    0xac0(%rip),%r15
mov    $0xb,%edi
mov    $0x12,%esi
mov    %eax,%edx
mov    $0xd,%ecx
xor    %r8d,%r8d
mov    %r15,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
lea    0xa78(%rip),%rsi
mov    $0xd,%edx
mov    %r14,%rdi
call   1040 <strncmp@plt>
mov    $0xb,%edi
mov    $0x13,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r15,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
xor    (%rsp),%rbp
xor    0x5(%rsp),%r13
or     %rbp,%r13
je     167f <tb+0x4af>
lea    0xa0b(%rip),%rdi
lea    0xa34(%rip),%r8
mov    %rsp,%rdx
mov    $0xd,%esi
mov    $0xd,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xa54(%rip),%r14
mov    %ebx,%edi
mov    $0x1d,%esi
mov    %r14,%rdx
mov    $0xc,%ecx
xor    %eax,%eax
call   10c0 <i2c_write_i2c_block_data@plt>
lea    0xa44(%rip),%r9
mov    $0xb,%edi
mov    $0x14,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    %rsp,%r15
mov    %ebx,%edi
mov    $0x1d,%esi
mov    %r15,%rdx
mov    $0xc,%ecx
xor    %eax,%eax
call   1080 <i2c_read_i2c_block_data@plt>
lea    0x9e7(%rip),%r12
mov    $0xb,%edi
mov    $0x15,%esi
mov    %eax,%edx
mov    $0xc,%ecx
xor    %r8d,%r8d
mov    %r12,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
mov    $0xc,%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strncmp@plt>
mov    $0xb,%edi
mov    $0x16,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r12,%r9
xor    %eax,%eax
call   1030 <CHECK@plt>
movabs $0x3c2c3a3b3d2b2d28,%rax
3a 2c 3c
xor    (%rsp),%rax
mov    0x8(%rsp),%ecx
xor    $0x2925213e,%rcx
or     %rax,%rcx
je     1764 <tb+0x594>
lea    0x926(%rip),%rdi
lea    0x98a(%rip),%r8
mov    %rsp,%rdx
mov    $0xc,%esi
mov    $0xc,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   10e0 <i2c_close@plt>
lea    0x98c(%rip),%r9
mov    $0xb,%edi
mov    $0x17,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1030 <CHECK@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"SMBus / I2C tests.\00"
@.str.1 = [9 x i8] c"i2c open\00"
@.str.2 = [2 x i8] zeroinitializer
@.str.3 = [17 x i8] c"i2c write device\00"
@.str.4 = [16 x i8] c"i2c read device\00"
@.str.5 = [14 x i8] c"i2c read byte\00"
@.str.6 = [19 x i8] c"i2c read byte data\00"
@.str.7 = [15 x i8] c"\1D[aBcDeFgHjKM]\00"
@.str.8 = [2 x i8] c"\1D\00"
@.str.9 = [28 x i8] c"got [%.*s] expected [%.*s]\0A\00"
@.str.10 = [20 x i8] c"i2c write byte data\00"
@.str.11 = [14 x i8] c"[1234567890#]\00"
@.str.12 = [21 x i8] c"i2c write block data\00"
@.str.13 = [24 x i8] c"i2c read i2c block data\00"
@.str.14 = [13 x i8] c"(-+=;:,<>!%)\00"
@.str.15 = [25 x i8] c"i2c write i2c block data\00"
@.str.16 = [10 x i8] c"i2c close\00"
define void @tb() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [128 x i8]
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @i2c_open to i32 (i32, i32, i32, ...)*)(i32 1, i32 83, i32 0)
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 1, i32 %9, i32 0, i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_device to i32 (i32, i8*, i32, ...)*)(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 2, i32 %13, i32 0, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%17 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_device to i32 (i32, i8*, i32, ...)*)(i32 %15, i8* %16, i32 1)
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 3, i32 %18, i32 1, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 4, i32 %22, i32 229, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%24 = load i32, i32* %1
%25 = call i32 (i32, ...) bitcast (i32 (...)* @i2c_read_byte to i32 (i32, ...)*)(i32 %24)
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 5, i32 %26, i32 229, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%28 = load i32, i32* %1
%29 = call i32 (i32, i32, ...) bitcast (i32 (...)* @i2c_read_byte_data to i32 (i32, i32, ...)*)(i32 %28, i32 0)
store i32 %29, i32* %3
%30 = load i32, i32* %3
%31 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 6, i32 %30, i32 229, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%32 = load i32, i32* %1
%33 = call i32 (i32, i32, ...) bitcast (i32 (...)* @i2c_read_byte_data to i32 (i32, i32, ...)*)(i32 %32, i32 48)
store i32 %33, i32* %3
%34 = load i32, i32* %3
%35 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 7, i32 %34, i32 2, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8** %5
%36 = load i8*, i8** %5
%37 = call i64 @strlen(i8* %36)
%38 = trunc i64 %37 to i32
store i32 %38, i32* %4
%39 = load i32, i32* %1
%40 = load i8*, i8** %5
%41 = load i32, i32* %4
%42 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_device to i32 (i32, i8*, i32, ...)*)(i32 %39, i8* %40, i32 %41)
store i32 %42, i32* %2
%43 = load i32, i32* %2
%44 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 8, i32 %43, i32 0, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%45 = load i32, i32* %1
%46 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_device to i32 (i32, i8*, i32, ...)*)(i32 %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 1)
store i32 %46, i32* %2
%47 = load i32, i32* %1
%48 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%49 = load i32, i32* %4
%50 = sub nsw i32 %49, 1
%51 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_device to i32 (i32, i8*, i32, ...)*)(i32 %47, i8* %48, i32 %50)
store i32 %51, i32* %3
%52 = load i32, i32* %3
%53 = load i32, i32* %4
%54 = sub nsw i32 %53, 1
%55 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 9, i32 %52, i32 %54, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%56 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%57 = load i8*, i8** %5
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = load i32, i32* %4
%60 = sub nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = call i32 @strncmp(i8* %56, i8* %58, i64 %61)
%63 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 10, i32 %62, i32 0, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%65 = load i8*, i8** %5
%66 = getelementptr inbounds i8, i8* %65, i64 1
%67 = load i32, i32* %4
%68 = sub nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = call i32 @strncmp(i8* %64, i8* %66, i64 %69)
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %81
72: ; preds = %0
%73 = load i32, i32* %4
%74 = sub nsw i32 %73, 1
%75 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%76 = load i32, i32* %4
%77 = sub nsw i32 %76, 1
%78 = load i8*, i8** %5
%79 = getelementptr inbounds i8, i8* %78, i64 1
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 %74, i8* %75, i32 %77, i8* %79)
br label %81
81: ; preds = %72, %0
%82 = load i32, i32* %1
%83 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @i2c_write_byte_data to i32 (i32, i32, i32, ...)*)(i32 %82, i32 29, i32 170)
store i32 %83, i32* %2
%84 = load i32, i32* %2
%85 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 11, i32 %84, i32 0, i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%86 = load i32, i32* %1
%87 = call i32 (i32, i32, ...) bitcast (i32 (...)* @i2c_read_byte_data to i32 (i32, i32, ...)*)(i32 %86, i32 29)
store i32 %87, i32* %3
%88 = load i32, i32* %3
%89 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 12, i32 %88, i32 170, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%90 = load i32, i32* %1
%91 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @i2c_write_byte_data to i32 (i32, i32, i32, ...)*)(i32 %90, i32 29, i32 85)
store i32 %91, i32* %2
%92 = load i32, i32* %2
%93 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 13, i32 %92, i32 0, i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%94 = load i32, i32* %1
%95 = call i32 (i32, i32, ...) bitcast (i32 (...)* @i2c_read_byte_data to i32 (i32, i32, ...)*)(i32 %94, i32 29)
store i32 %95, i32* %3
%96 = load i32, i32* %3
%97 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 14, i32 %96, i32 85, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8** %5
%98 = load i8*, i8** %5
%99 = call i64 @strlen(i8* %98)
%100 = trunc i64 %99 to i32
store i32 %100, i32* %4
%101 = load i32, i32* %1
%102 = load i8*, i8** %5
%103 = load i32, i32* %4
%104 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_block_data to i32 (i32, i32, i8*, i32, ...)*)(i32 %101, i32 28, i8* %102, i32 %103)
store i32 %104, i32* %2
%105 = load i32, i32* %2
%106 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 15, i32 %105, i32 0, i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
%107 = load i32, i32* %1
%108 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_device to i32 (i32, i8*, i32, ...)*)(i32 %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 1)
store i32 %108, i32* %2
%109 = load i32, i32* %1
%110 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%111 = load i32, i32* %4
%112 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_device to i32 (i32, i8*, i32, ...)*)(i32 %109, i8* %110, i32 %111)
store i32 %112, i32* %3
%113 = load i32, i32* %3
%114 = load i32, i32* %4
%115 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 16, i32 %113, i32 %114, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%116 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%117 = load i8*, i8** %5
%118 = load i32, i32* %4
%119 = sext i32 %118 to i64
%120 = call i32 @strncmp(i8* %116, i8* %117, i64 %119)
%121 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 17, i32 %120, i32 0, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%122 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%123 = load i8*, i8** %5
%124 = load i32, i32* %4
%125 = sext i32 %124 to i64
%126 = call i32 @strncmp(i8* %122, i8* %123, i64 %125)
%127 = icmp ne i32 %126, 0
br i1 %127, label %128, label %134
128: ; preds = %81
%129 = load i32, i32* %4
%130 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%131 = load i32, i32* %4
%132 = load i8*, i8** %5
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 %129, i8* %130, i32 %131, i8* %132)
br label %134
134: ; preds = %128, %81
%135 = load i32, i32* %1
%136 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%137 = load i32, i32* %4
%138 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_i2c_block_data to i32 (i32, i32, i8*, i32, ...)*)(i32 %135, i32 29, i8* %136, i32 %137)
store i32 %138, i32* %3
%139 = load i32, i32* %3
%140 = load i32, i32* %4
%141 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 18, i32 %139, i32 %140, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%142 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%143 = load i8*, i8** %5
%144 = load i32, i32* %4
%145 = sext i32 %144 to i64
%146 = call i32 @strncmp(i8* %142, i8* %143, i64 %145)
%147 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 19, i32 %146, i32 0, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%148 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%149 = load i8*, i8** %5
%150 = load i32, i32* %4
%151 = sext i32 %150 to i64
%152 = call i32 @strncmp(i8* %148, i8* %149, i64 %151)
%153 = icmp ne i32 %152, 0
br i1 %153, label %154, label %160
154: ; preds = %134
%155 = load i32, i32* %4
%156 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%157 = load i32, i32* %4
%158 = load i8*, i8** %5
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 %155, i8* %156, i32 %157, i8* %158)
br label %160
160: ; preds = %154, %134
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8** %5
%161 = load i8*, i8** %5
%162 = call i64 @strlen(i8* %161)
%163 = trunc i64 %162 to i32
store i32 %163, i32* %4
%164 = load i32, i32* %1
%165 = load i8*, i8** %5
%166 = load i32, i32* %4
%167 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_i2c_block_data to i32 (i32, i32, i8*, i32, ...)*)(i32 %164, i32 29, i8* %165, i32 %166)
store i32 %167, i32* %2
%168 = load i32, i32* %2
%169 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 20, i32 %168, i32 0, i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0))
%170 = load i32, i32* %1
%171 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%172 = load i32, i32* %4
%173 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_i2c_block_data to i32 (i32, i32, i8*, i32, ...)*)(i32 %170, i32 29, i8* %171, i32 %172)
store i32 %173, i32* %3
%174 = load i32, i32* %3
%175 = load i32, i32* %4
%176 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 21, i32 %174, i32 %175, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%177 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%178 = load i8*, i8** %5
%179 = load i32, i32* %4
%180 = sext i32 %179 to i64
%181 = call i32 @strncmp(i8* %177, i8* %178, i64 %180)
%182 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 22, i32 %181, i32 0, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%183 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%184 = load i8*, i8** %5
%185 = load i32, i32* %4
%186 = sext i32 %185 to i64
%187 = call i32 @strncmp(i8* %183, i8* %184, i64 %186)
%188 = icmp ne i32 %187, 0
br i1 %188, label %189, label %195
189: ; preds = %160
%190 = load i32, i32* %4
%191 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%192 = load i32, i32* %4
%193 = load i8*, i8** %5
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 %190, i8* %191, i32 %192, i8* %193)
br label %195
195: ; preds = %189, %160
%196 = load i32, i32* %1
%197 = call i32 (i32, ...) bitcast (i32 (...)* @i2c_close to i32 (i32, ...)*)(i32 %196)
store i32 %197, i32* %2
%198 = load i32, i32* %2
%199 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 23, i32 %198, i32 0, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"SMBus / I2C tests.\00"
@.str.1 = [9 x i8] c"i2c open\00"
@.str.2 = [2 x i8] zeroinitializer
@.str.3 = [17 x i8] c"i2c write device\00"
@.str.4 = [16 x i8] c"i2c read device\00"
@.str.5 = [14 x i8] c"i2c read byte\00"
@.str.6 = [19 x i8] c"i2c read byte data\00"
@.str.7 = [15 x i8] c"\1D[aBcDeFgHjKM]\00"
@.str.8 = [2 x i8] c"\1D\00"
@.str.9 = [28 x i8] c"got [%.*s] expected [%.*s]\0A\00"
@.str.10 = [20 x i8] c"i2c write byte data\00"
@.str.11 = [14 x i8] c"[1234567890#]\00"
@.str.12 = [21 x i8] c"i2c write block data\00"
@.str.13 = [24 x i8] c"i2c read i2c block data\00"
@.str.14 = [13 x i8] c"(-+=;:,<>!%)\00"
@.str.15 = [25 x i8] c"i2c write i2c block data\00"
@.str.16 = [10 x i8] c"i2c close\00"
define void @tb() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @i2c_open to i32 (i32, i32, i32, ...)*)(i32 1, i32 83, i32 0)
%5 = tail call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 1, i32 %4, i32 0, i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_device to i32 (i32, i8*, i32, ...)*)(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%7 = tail call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 2, i32 %6, i32 0, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_device to i32 (i32, i8*, i32, ...)*)(i32 %4, i8* %2, i32 1)
%9 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 3, i32 %8, i32 1, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 4, i32 %11, i32 229, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i32, ...) bitcast (i32 (...)* @i2c_read_byte to i32 (i32, ...)*)(i32 %4)
%14 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 5, i32 %13, i32 229, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i32, i32, ...) bitcast (i32 (...)* @i2c_read_byte_data to i32 (i32, i32, ...)*)(i32 %4, i32 0)
%16 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 6, i32 %15, i32 229, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 (i32, i32, ...) bitcast (i32 (...)* @i2c_read_byte_data to i32 (i32, i32, ...)*)(i32 %4, i32 48)
%18 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 7, i32 %17, i32 2, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_device to i32 (i32, i8*, i32, ...)*)(i32 %4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 14)
%20 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 8, i32 %19, i32 0, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_device to i32 (i32, i8*, i32, ...)*)(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 1)
%22 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_device to i32 (i32, i8*, i32, ...)*)(i32 %4, i8* %2, i32 13)
%23 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 9, i32 %22, i32 13, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 @strncmp(i8* %2, i8* dereferenceable(14) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 1), i64 13)
%25 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 10, i32 %24, i32 0, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 @bcmp(i8* dereferenceable(13) %2, i8* dereferenceable(13) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 1), i64 13)
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %0
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 13, i8* %2, i32 13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 1))
br label %30
30: ; preds = %28, %0
%31 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @i2c_write_byte_data to i32 (i32, i32, i32, ...)*)(i32 %4, i32 29, i32 170)
%32 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 11, i32 %31, i32 0, i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%33 = call i32 (i32, i32, ...) bitcast (i32 (...)* @i2c_read_byte_data to i32 (i32, i32, ...)*)(i32 %4, i32 29)
%34 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 12, i32 %33, i32 170, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%35 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @i2c_write_byte_data to i32 (i32, i32, i32, ...)*)(i32 %4, i32 29, i32 85)
%36 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 13, i32 %35, i32 0, i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%37 = call i32 (i32, i32, ...) bitcast (i32 (...)* @i2c_read_byte_data to i32 (i32, i32, ...)*)(i32 %4, i32 29)
%38 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 14, i32 %37, i32 85, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%39 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_block_data to i32 (i32, i32, i8*, i32, ...)*)(i32 %4, i32 28, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 13)
%40 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 15, i32 %39, i32 0, i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
%41 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_device to i32 (i32, i8*, i32, ...)*)(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 1)
%42 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_device to i32 (i32, i8*, i32, ...)*)(i32 %4, i8* %2, i32 13)
%43 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 16, i32 %42, i32 13, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%44 = call i32 @strncmp(i8* %2, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i64 13)
%45 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 17, i32 %44, i32 0, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 @bcmp(i8* dereferenceable(13) %2, i8* dereferenceable(13) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i64 13)
%47 = icmp eq i32 %46, 0
br i1 %47, label %50, label %48
48: ; preds = %30
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 13, i8* %2, i32 13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
br label %50
50: ; preds = %48, %30
%51 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_i2c_block_data to i32 (i32, i32, i8*, i32, ...)*)(i32 %4, i32 29, i8* %2, i32 13)
%52 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 18, i32 %51, i32 13, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%53 = call i32 @strncmp(i8* %2, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i64 13)
%54 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 19, i32 %53, i32 0, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%55 = call i32 @bcmp(i8* dereferenceable(13) %2, i8* dereferenceable(13) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i64 13)
%56 = icmp eq i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %50
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 13, i8* %2, i32 13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
br label %59
59: ; preds = %57, %50
%60 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_write_i2c_block_data to i32 (i32, i32, i8*, i32, ...)*)(i32 %4, i32 29, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i32 12)
%61 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 20, i32 %60, i32 0, i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0))
%62 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @i2c_read_i2c_block_data to i32 (i32, i32, i8*, i32, ...)*)(i32 %4, i32 29, i8* %2, i32 12)
%63 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 21, i32 %62, i32 12, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%64 = call i32 @strncmp(i8* %2, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i64 12)
%65 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 22, i32 %64, i32 0, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%66 = call i32 @bcmp(i8* dereferenceable(12) %2, i8* dereferenceable(12) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i64 12)
%67 = icmp eq i32 %66, 0
br i1 %67, label %70, label %68
68: ; preds = %59
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 12, i8* %2, i32 12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
br label %70
70: ; preds = %68, %59
%71 = call i32 (i32, ...) bitcast (i32 (...)* @i2c_close to i32 (i32, ...)*)(i32 %4)
%72 = call i32 (i32, i32, i32, i32, i32, i8*, ...) bitcast (i32 (...)* @CHECK to i32 (i32, i32, i32, i32, i32, i8*, ...)*)(i32 11, i32 23, i32 %71, i32 0, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0))
ret void
}