#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*/ convert_values_weight_us(double *, double *);
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *, double *);
int /*<<< orphan*/ validate_values(int *, double *, int);
void initial_values_weight_us() {
  int main_value, scanf_return;
  double sec_value, main_value_db;
  printf("Please enter your values to be converted (Kilograms, Grams): ");
  scanf_return = scanf("%d %lf", &main_value, &sec_value);
  validate_values(&main_value, &sec_value, scanf_return);
  main_value_db = main_value;
  convert_values_weight_us(&main_value_db, &sec_value);
}


x86 assembly (clang, -O0):
<initial_values_weight_us>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <scanf@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    -0x4(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <validate_values@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <convert_values_weight_us@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initial_values_weight_us>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
lea    0x4(%rsp),%r14
lea    0x10(%rsp),%rbx
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <validate_values@plt>
cvtsi2sdl 0x4(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <convert_values_weight_us@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [62 x i8] c"Please enter your values to be converted (Kilograms, Grams): \00"
@.str.1 = [7 x i8] c"%d %lf\00"
define void @initial_values_weight_us() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, double* %3)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @validate_values(i32* %1, double* %3, i32 %7)
%9 = load i32, i32* %1
%10 = sitofp i32 %9 to double
store double %10, double* %4
%11 = call i32 @convert_values_weight_us(double* %4, double* %3)
ret void
}

LLVM IR (-O2):
@.str = [62 x i8] c"Please enter your values to be converted (Kilograms, Grams): \00"
@.str.1 = [7 x i8] c"%d %lf\00"
define void @initial_values_weight_us() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = bitcast i32* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, double* %2)
%9 = call i32 @validate_values(i32* %1, double* %2, i32 %8)
%10 = load i32, i32* %1
%11 = sitofp i32 %10 to double
store double %11, double* %3
%12 = call i32 @convert_values_weight_us(double* %3, double* %2)
ret void
}