#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*/ print_double(double, char const *);
int /*<<< orphan*/ printf(char *);
void print_double_test() {
  printf("============= print_double_test ================\n");
  const char *format1 = "%.1f\n";
  print_double(1.55, format1);
  print_double(1.65, format1);
  print_double(1.75, format1);
  print_double(1.85, format1);
  const char *format2 = "%.2f\n";
  print_double(0.155, format2);
  print_double(0.165, format2);
  print_double(0.175, format2);
  print_double(0.185, format2);
}


x86 assembly (clang, -O0):
<print_double_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xf11(%rip),%rdi
call   1030 <printf@plt>
lea    0xf37(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
movsd  0xeed(%rip),%xmm0
call   1040 <print_double@plt>
mov    -0x8(%rbp),%rdi
movsd  0xed4(%rip),%xmm0
call   1040 <print_double@plt>
mov    -0x8(%rbp),%rdi
movsd  0xebb(%rip),%xmm0
call   1040 <print_double@plt>
mov    -0x8(%rbp),%rdi
movsd  0xea2(%rip),%xmm0
call   1040 <print_double@plt>
lea    0xeee(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movsd  0xe7e(%rip),%xmm0
call   1040 <print_double@plt>
mov    -0x10(%rbp),%rdi
movsd  0xe65(%rip),%xmm0
call   1040 <print_double@plt>
mov    -0x10(%rbp),%rdi
movsd  0xe4c(%rip),%xmm0
call   1040 <print_double@plt>
mov    -0x10(%rbp),%rdi
movsd  0xe33(%rip),%xmm0
call   1040 <print_double@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_double_test>:
push   %rbx
lea    0xf24(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0c(%rip),%rbx
movsd  0xec4(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <print_double@plt>
movsd  0xebc(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <print_double@plt>
movsd  0xeb4(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <print_double@plt>
movsd  0xeac(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <print_double@plt>
lea    0xecb(%rip),%rbx
movsd  0xe9d(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <print_double@plt>
movsd  0xe95(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <print_double@plt>
movsd  0xe8d(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <print_double@plt>
movsd  0xe85(%rip),%xmm0
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <print_double@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"============= print_double_test ================\0A\00"
@.str.1 = [6 x i8] c"%.1f\0A\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
define void @print_double_test() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @print_double(double 1.550000e+00, i8* %4)
%6 = load i8*, i8** %1
%7 = call i32 @print_double(double 1.650000e+00, i8* %6)
%8 = load i8*, i8** %1
%9 = call i32 @print_double(double 1.750000e+00, i8* %8)
%10 = load i8*, i8** %1
%11 = call i32 @print_double(double 1.850000e+00, i8* %10)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
%12 = load i8*, i8** %2
%13 = call i32 @print_double(double 1.550000e-01, i8* %12)
%14 = load i8*, i8** %2
%15 = call i32 @print_double(double 1.650000e-01, i8* %14)
%16 = load i8*, i8** %2
%17 = call i32 @print_double(double 1.750000e-01, i8* %16)
%18 = load i8*, i8** %2
%19 = call i32 @print_double(double 1.850000e-01, i8* %18)
ret void
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%.1f\0A\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
@str = [49 x i8] c"============= print_double_test ================\00"
define void @print_double_test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @print_double(double 1.550000e+00, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @print_double(double 1.650000e+00, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @print_double(double 1.750000e+00, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @print_double(double 1.850000e+00, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @print_double(double 1.550000e-01, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @print_double(double 1.650000e-01, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @print_double(double 1.750000e-01, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @print_double(double 1.850000e-01, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}