#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 */
double atof(char *);
int /*<<< orphan*/ fill_buffer(double);
int /*<<< orphan*/ print_buffer();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int main(int argc, char *argv[]) {
  double x;
  int i;
  for (i = 1; i < argc; i++) {
    x = atof(argv[i]);
    printf("printf => %f\n", x);
    printf("FBSTP  => ");
    fill_buffer(x);
    print_buffer();
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d9 <main+0x89>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1040 <fill_buffer@plt>
mov    $0x0,%al
call   1070 <print_buffer@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jl     11c8 <main+0x78>
mov    %rsi,%r12
mov    %edi,%r13d
mov    $0x1,%ebx
lea    0xe8c(%rip),%r14
lea    0xe93(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbx,8),%rdi
call   1050 <atof@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1040 <fill_buffer@plt>
xor    %eax,%eax
call   1070 <print_buffer@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1180 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"printf => %f\0A\00"
@.str.1 = [11 x i8] c"FBSTP => \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
br label %8
8: ; preds = %26, %2
%9 = load i32, i32* %7
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %29
12: ; preds = %8
%13 = load i8**, i8*** %5
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call double @atof(i8* %17)
store double %18, double* %6
%19 = load double, double* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%22 = load double, double* %6
%23 = call i32 @fill_buffer(double %22)
%24 = call i32 (...) @print_buffer()
%25 = call i32 @putchar(i8 signext 10)
br label %26
26: ; preds = %12
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %8
29: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"printf => %f\0A\00"
@.str.1 = [11 x i8] c"FBSTP => \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 1, %4 ], [ %16, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call double @atof(i8* %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @fill_buffer(double %10)
%14 = tail call i32 (...) @print_buffer()
%15 = tail call i32 @putchar(i8 signext 10)
%16 = add nuw nsw i64 %7, 1
%17 = icmp eq i64 %16, %5
br i1 %17, label %18, label %6
18: ; preds = %6, %2
ret i32 0
}