#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_Acquiring_AnalogInputValue(int, int *);
int /*<<< orphan*/ Calculate_Analog_Input_Value_for_1Ch(int, float *);
int /*<<< orphan*/ UARTD2_SendData(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int, int, float);
int strlen(char *);
void Test_1Ch_ADC_Voltage_Measurement(void) {
  int iADC_CHn = 1;
  int iAdcCntValue = 0;
  float fVoltage = 0.0000f;
  char sAdcMeasureResult[128] = {0};
  ADC_Acquiring_AnalogInputValue(iADC_CHn, &iAdcCntValue);
  Calculate_Analog_Input_Value_for_1Ch(iADC_CHn, &fVoltage);
  sprintf(sAdcMeasureResult, "ADC %d:COUNT %d\tADC %d:VOLT  %f\n", iADC_CHn,
          iAdcCntValue, fVoltage);
  UARTD2_SendData(sAdcMeasureResult, strlen(sAdcMeasureResult) * sizeof(char));
  return;
}


x86 assembly (clang, -O0):
<Test_1Ch_ADC_Voltage_Measurement>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1070 <ADC_Acquiring_AnalogInputValue@plt>
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1030 <Calculate_Analog_Input_Value_for_1Ch@plt>
lea    -0x90(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
movss  -0xc(%rbp),%xmm0
lea    0xe3b(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x98(%rbp),%rdi
cltq
shl    $0x0,%rax
mov    %eax,%esi
call   1060 <UARTD2_SendData@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test_1Ch_ADC_Voltage_Measurement>:
push   %rbx
sub    $0x90,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x1,%edi
call   1060 <ADC_Acquiring_AnalogInputValue@plt>
lea    0x8(%rsp),%rsi
mov    $0x1,%edi
call   1030 <Calculate_Analog_Input_Value_for_1Ch@plt>
mov    0xc(%rsp),%ecx
movss  0x8(%rsp),%xmm0
lea    0xe3b(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%edx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <UARTD2_SendData@plt>
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"ADC %d:COUNT %d\09ADC %d:VOLT %f\0A\00"
define void @Test_1Ch_ADC_Voltage_Measurement() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca [128 x i8]
store i32 1, i32* %1
store i32 0, i32* %2
store float 0.000000e+00, float* %3
%5 = bitcast [128 x i8]* %4 to i8*
%6 = load i32, i32* %1
%7 = call i32 @ADC_Acquiring_AnalogInputValue(i32 %6, i32* %2)
%8 = load i32, i32* %1
%9 = call i32 @Calculate_Analog_Input_Value_for_1Ch(i32 %8, float* %3)
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = load float, float* %3
%14 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, float %13)
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = sext i32 %17 to i64
%19 = mul i64 %18, 1
%20 = trunc i64 %19 to i32
%21 = call i32 @UARTD2_SendData(i8* %15, i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"ADC %d:COUNT %d\09ADC %d:VOLT %f\0A\00"
define void @Test_1Ch_ADC_Voltage_Measurement() {
%1 = alloca i32
%2 = alloca float
%3 = alloca [128 x i8]
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%7 = call i32 @ADC_Acquiring_AnalogInputValue(i32 1, i32* %1)
%8 = call i32 @Calculate_Analog_Input_Value_for_1Ch(i32 1, float* %2)
%9 = load i32, i32* %1
%10 = load float, float* %2
%11 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 1, i32 %9, float %10)
%12 = call i32 @strlen(i8* %6)
%13 = call i32 @UARTD2_SendData(i8* %6, i32 %12)
ret void
}