#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int PbI2cGetADC(int);
int PbI2cGetRegister(int);
int /*<<< orphan*/ printf(char *, ...);
void PbPrintStatus() {
  printf("   STATUS\n");
  printf("############\n\n");
  unsigned char i = 0;
  for (i = 0; i < 8; i++) {
    printf("ADC%d = %dmV\n", i, PbI2cGetADC(0x10 + i * 2));
  }
  printf("\nADC-VCC = %dmV\n", PbI2cGetADC(0x20));
  printf("ADC-+5V = %dmV\n\n", PbI2cGetADC(0x22));
  printf("TRISB = 0x%X\n", PbI2cGetRegister(0x01));
  printf("PORTB = 0x%X\n\n", PbI2cGetRegister(0x0F));
  printf("############\n\n");
}


x86 assembly (clang, -O0):
<PbPrintStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x0,-0x1(%rbp)
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x8,%eax
jge    119f <PbPrintStatus+0x6f>
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
movzbl -0x1(%rbp),%edi
shl    $0x1,%edi
add    $0x10,%edi
call   1040 <PbI2cGetADC@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    115c <PbPrintStatus+0x2c>
mov    $0x20,%edi
call   1040 <PbI2cGetADC@plt>
mov    %eax,%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x22,%edi
call   1040 <PbI2cGetADC@plt>
mov    %eax,%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <PbI2cGetRegister@plt>
mov    %eax,%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xf,%edi
call   1050 <PbI2cGetRegister@plt>
mov    %eax,%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PbPrintStatus>:
push   %r14
push   %rbx
push   %rax
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xf00(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    $0x10,%edi
call   1050 <PbI2cGetADC@plt>
lea    0xe90(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x12,%edi
call   1050 <PbI2cGetADC@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x14,%edi
call   1050 <PbI2cGetADC@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x16,%edi
call   1050 <PbI2cGetADC@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x18,%edi
call   1050 <PbI2cGetADC@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1a,%edi
call   1050 <PbI2cGetADC@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1c,%edi
call   1050 <PbI2cGetADC@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1e,%edi
call   1050 <PbI2cGetADC@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1050 <PbI2cGetADC@plt>
lea    0xdc2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x22,%edi
call   1050 <PbI2cGetADC@plt>
lea    0xdb9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <PbI2cGetRegister@plt>
lea    0xdb0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xf,%edi
call   1060 <PbI2cGetRegister@plt>
lea    0xda4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [11 x i8] c" STATUS\0A\00"
@.str.1 = [15 x i8] c"############\0A\0A\00"
@.str.2 = [14 x i8] c"ADC%d = %dmV\0A\00"
@.str.3 = [17 x i8] c"\0AADC-VCC = %dmV\0A\00"
@.str.4 = [17 x i8] c"ADC-+5V = %dmV\0A\0A\00"
@.str.5 = [14 x i8] c"TRISB = 0x%X\0A\00"
@.str.6 = [15 x i8] c"PORTB = 0x%X\0A\0A\00"
define void @PbPrintStatus() {
%1 = alloca i8
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i8 0, i8* %1
store i8 0, i8* %1
br label %4
4: ; preds = %17, %0
%5 = load i8, i8* %1
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %20
8: ; preds = %4
%9 = load i8, i8* %1
%10 = zext i8 %9 to i32
%11 = load i8, i8* %1
%12 = zext i8 %11 to i32
%13 = mul nsw i32 %12, 2
%14 = add nsw i32 16, %13
%15 = call i32 @PbI2cGetADC(i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %15)
br label %17
17: ; preds = %8
%18 = load i8, i8* %1
%19 = add i8 %18, 1
store i8 %19, i8* %1
br label %4
20: ; preds = %4
%21 = call i32 @PbI2cGetADC(i32 32)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = call i32 @PbI2cGetADC(i32 34)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = call i32 @PbI2cGetRegister(i32 1)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%27 = call i32 @PbI2cGetRegister(i32 15)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [14 x i8] c"ADC%d = %dmV\0A\00"
@.str.3 = [17 x i8] c"\0AADC-VCC = %dmV\0A\00"
@.str.4 = [17 x i8] c"ADC-+5V = %dmV\0A\0A\00"
@.str.5 = [14 x i8] c"TRISB = 0x%X\0A\00"
@.str.6 = [15 x i8] c"PORTB = 0x%X\0A\0A\00"
@str = [10 x i8] c" STATUS\00"
@str.8 = [14 x i8] c"############\0A\00"
define void @PbPrintStatus() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
%3 = tail call i32 @PbI2cGetADC(i32 16)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %3)
%5 = tail call i32 @PbI2cGetADC(i32 18)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %5)
%7 = tail call i32 @PbI2cGetADC(i32 20)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %7)
%9 = tail call i32 @PbI2cGetADC(i32 22)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %9)
%11 = tail call i32 @PbI2cGetADC(i32 24)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 %11)
%13 = tail call i32 @PbI2cGetADC(i32 26)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 5, i32 %13)
%15 = tail call i32 @PbI2cGetADC(i32 28)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 6, i32 %15)
%17 = tail call i32 @PbI2cGetADC(i32 30)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 7, i32 %17)
%19 = tail call i32 @PbI2cGetADC(i32 32)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = tail call i32 @PbI2cGetADC(i32 34)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = tail call i32 @PbI2cGetRegister(i32 1)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %23)
%25 = tail call i32 @PbI2cGetRegister(i32 15)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
ret void
}