#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 /*<<< orphan*/ adcspi_get_output(int, int);
int /*<<< orphan*/ armprintf(char *, ...);
void ui_getadcspi(char *cmdstr) {
  int i, j;
  armprintf("Off-board ADC outputs: \r");
  for (i = 0; i < 4; i++) {
    armprintf("ADC%d: ", i);
    for (j = 0; j < 16; j++) {
      armprintf("%d ", adcspi_get_output(i, j));
    }
    armprintf("\r");
  }
}


x86 assembly (clang, -O0):
<ui_getadcspi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <armprintf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11b2 <ui_getadcspi+0x92>
mov    -0xc(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <armprintf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    1196 <ui_getadcspi+0x76>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <adcspi_get_output@plt>
mov    %eax,%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <armprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1163 <ui_getadcspi+0x43>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <armprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <ui_getadcspi+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui_getadcspi>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <armprintf@plt>
lea    0xedd(%rip),%r14
lea    0xede(%rip),%rbx
lea    0xecd(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0x6,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0x7,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0x8,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0x9,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0xa,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0xb,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0xc,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0xd,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0xe,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %ebp,%edi
mov    $0xf,%esi
call   1040 <adcspi_get_output@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <armprintf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <armprintf@plt>
add    $0x1,%ebp
cmp    $0x4,%ebp
jne    1150 <ui_getadcspi+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Off-board ADC outputs: \0D\00"
@.str.1 = [8 x i8] c"ADC%d: \00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0D\00"
define void @ui_getadcspi(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %25, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %28
9: ; preds = %6
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %10)
store i32 0, i32* %4
br label %12
12: ; preds = %20, %9
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 16
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 @adcspi_get_output(i32 %16, i32 %17)
%19 = call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %15
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %12
23: ; preds = %12
%24 = call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %23
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %6
28: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Off-board ADC outputs: \0D\00"
@.str.1 = [8 x i8] c"ADC%d: \00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0D\00"
define void @ui_getadcspi(i8* nocapture readnone %0) {
%2 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %39, %3 ]
%5 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @adcspi_get_output(i32 %4, i32 0)
%7 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = tail call i32 @adcspi_get_output(i32 %4, i32 1)
%9 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = tail call i32 @adcspi_get_output(i32 %4, i32 2)
%11 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = tail call i32 @adcspi_get_output(i32 %4, i32 3)
%13 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = tail call i32 @adcspi_get_output(i32 %4, i32 4)
%15 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = tail call i32 @adcspi_get_output(i32 %4, i32 5)
%17 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = tail call i32 @adcspi_get_output(i32 %4, i32 6)
%19 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = tail call i32 @adcspi_get_output(i32 %4, i32 7)
%21 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = tail call i32 @adcspi_get_output(i32 %4, i32 8)
%23 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = tail call i32 @adcspi_get_output(i32 %4, i32 9)
%25 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = tail call i32 @adcspi_get_output(i32 %4, i32 10)
%27 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = tail call i32 @adcspi_get_output(i32 %4, i32 11)
%29 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = tail call i32 @adcspi_get_output(i32 %4, i32 12)
%31 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = tail call i32 @adcspi_get_output(i32 %4, i32 13)
%33 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = tail call i32 @adcspi_get_output(i32 %4, i32 14)
%35 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = tail call i32 @adcspi_get_output(i32 %4, i32 15)
%37 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = tail call i32 (i8*, ...) @armprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%39 = add nuw nsw i32 %4, 1
%40 = icmp eq i32 %39, 4
br i1 %40, label %41, label %3
41: ; preds = %3
ret void
}