#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*/ adc_get_data(int, char *, int *);
int /*<<< orphan*/ adc_get_device_name(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int iotbus_adc_test() {
  int channel = 0;
  char devName[16] = {0};
  int voltage;
  printf("<<< iotbus_adc_test >>>\n");
  adc_get_device_name(devName);
  while (1) {
    adc_get_data(channel, devName, &voltage);
    printf("adc_get_data(%d)\n", voltage);
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<iotbus_adc_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <adc_get_device_name@plt>
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1030 <adc_get_data@plt>
mov    -0x24(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1186 <iotbus_adc_test+0x36>

x86 assembly (clang, -O2):
<iotbus_adc_test>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1060 <adc_get_device_name@plt>
lea    0xc(%rsp),%r15
lea    0xe7a(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <adc_get_data@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1190 <iotbus_adc_test+0x40>

LLVM IR (-O0):
@.str = [25 x i8] c"<<< iotbus_adc_test >>>\0A\00"
@.str.1 = [18 x i8] c"adc_get_data(%d)\0A\00"
define i32 @iotbus_adc_test() {
%1 = alloca i32
%2 = alloca [16 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [16 x i8]* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = call i32 @adc_get_device_name(i8* %6)
br label %8
8: ; preds = %0, %8
%9 = load i32, i32* %1
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%11 = call i32 @adc_get_data(i32 %9, i8* %10, i32* %3)
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = call i32 @sleep(i32 1)
br label %8
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"adc_get_data(%d)\0A\00"
@str = [24 x i8] c"<<< iotbus_adc_test >>>\00"
define i32 @iotbus_adc_test() {
%1 = alloca [16 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%6 = call i32 @adc_get_device_name(i8* %3)
br label %7
7: ; preds = %7, %0
%8 = call i32 @adc_get_data(i32 0, i8* %3, i32* %2)
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 @sleep(i32 1)
br label %7
}