#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void fprintf_realnums(FILE *s, char *message1, double *doubles, int size,
                      char *message2) {
  int i;
  fprintf(s, "%s ", message1);
  if (doubles == NULL && size > 0)
    fprintf(s, "(double *) NULL");
  else {
    fprintf(s, "{ ");
    for (i = 0; i < size; i++)
      fprintf(s, "%g %s", doubles[i], (i == size - 1) ? "" : ", ");
    fprintf(s, "}");
  }
  fprintf(s, " %s", message2);
}


x86 assembly (clang, -O0):
<fprintf_realnums>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x18(%rbp)
jne    116d <fprintf_realnums+0x5d>
cmpl   $0x0,-0x1c(%rbp)
jle    116d <fprintf_realnums+0x5d>
mov    -0x8(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11ee <fprintf_realnums+0xde>
mov    -0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11dc <fprintf_realnums+0xcc>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x2c(%rbp),%ecx
mov    -0x1c(%rbp),%esi
sub    $0x1,%esi
lea    0xe6a(%rip),%rdx
lea    0xe65(%rip),%rax
cmp    %esi,%ecx
cmove  %rax,%rdx
lea    0xe50(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1186 <fprintf_realnums+0x76>
mov    -0x8(%rbp),%rdi
lea    0xe39(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe1c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprintf_realnums>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%rbx
mov    %ecx,%r12d
mov    %rdx,%r13
mov    %rsi,%rdx
mov    %rdi,%r15
lea    0xeaf(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r13,%r13
jne    1180 <fprintf_realnums+0x50>
test   %r12d,%r12d
jle    1180 <fprintf_realnums+0x50>
lea    0xe9b(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
jmp    1203 <fprintf_realnums+0xd3>
mov    %rbx,(%rsp)
lea    0xe89(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
test   %r12d,%r12d
jle    11f2 <fprintf_realnums+0xc2>
lea    -0x1(%r12),%ebx
mov    %r12d,%ebp
xor    %r14d,%r14d
lea    0xe63(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0x0(%r13,%r14,8),%xmm0
cmp    %r14,%rbx
lea    0xe4c(%rip),%rdx
lea    0xe47(%rip),%rax
cmove  %rax,%rdx
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    11c0 <fprintf_realnums+0x90>
mov    $0x7d,%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
mov    (%rsp),%rbx
lea    0xe0f(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s \00"
@.str.1 = [16 x i8] c"(double *) NULL\00"
@.str.2 = [3 x i8] c"{ \00"
@.str.3 = [6 x i8] c"%g %s\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [3 x i8] c", \00"
@.str.6 = [2 x i8] c"}\00"
@.str.7 = [4 x i8] c" %s\00"
define void @fprintf_realnums(i32* %0, i8* %1, double* %2, i32 %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store i32* %0, i32** %6
store i8* %1, i8** %7
store double* %2, double** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%12 = load i32*, i32** %6
%13 = load i8*, i8** %7
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load double*, double** %8
%16 = icmp eq double* %15, null
br i1 %16, label %17, label %23
17: ; preds = %5
%18 = load i32, i32* %9
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32*, i32** %6
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %50
23: ; preds = %17, %5
%24 = load i32*, i32** %6
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %11
br label %26
26: ; preds = %44, %23
%27 = load i32, i32* %11
%28 = load i32, i32* %9
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %47
30: ; preds = %26
%31 = load i32*, i32** %6
%32 = load double*, double** %8
%33 = load i32, i32* %11
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = load double, double* %35
%37 = load i32, i32* %11
%38 = load i32, i32* %9
%39 = sub nsw i32 %38, 1
%40 = icmp eq i32 %37, %39
%41 = zext i1 %40 to i64
%42 = select i1 %40, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %36, i8* %42)
br label %44
44: ; preds = %30
%45 = load i32, i32* %11
%46 = add nsw i32 %45, 1
store i32 %46, i32* %11
br label %26
47: ; preds = %26
%48 = load i32*, i32** %6
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %50
50: ; preds = %47, %20
%51 = load i32*, i32** %6
%52 = load i8*, i8** %10
%53 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %52)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
@.str.1 = [16 x i8] c"(double *) NULL\00"
@.str.2 = [3 x i8] c"{ \00"
@.str.3 = [6 x i8] c"%g %s\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [3 x i8] c", \00"
@.str.7 = [4 x i8] c" %s\00"
define void @fprintf_realnums(i32* nocapture %0, i8* %1, double* %2, i32 %3, i8* %4) {
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = icmp eq double* %2, null
%8 = icmp sgt i32 %3, 0
%9 = and i1 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 15, i64 1, i32* %0)
br label %29
12: ; preds = %5
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %0)
br i1 %8, label %14, label %27
14: ; preds = %12
%15 = add nsw i32 %3, -1
%16 = zext i32 %15 to i64
%17 = zext i32 %3 to i64
br label %18
18: ; preds = %14, %18
%19 = phi i64 [ 0, %14 ], [ %25, %18 ]
%20 = getelementptr inbounds double, double* %2, i64 %19
%21 = load double, double* %20
%22 = icmp eq i64 %19, %16
%23 = select i1 %22, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%24 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %21, i8* %23)
%25 = add nuw nsw i64 %19, 1
%26 = icmp eq i64 %25, %17
br i1 %26, label %27, label %18
27: ; preds = %18, %12
%28 = tail call i32 @fputc(i32 125, i32* %0)
br label %29
29: ; preds = %27, %10
%30 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %4)
ret void
}