void schreibe_double_array(const double array[], int laenge, int breite,
                           char *trenner, _Bool am_ende) {
  for (int i = 0; i < laenge - 1; i++)
    printf("%*lf%s", breite, array[i], trenner);
  printf("%*lf%s", breite, array[laenge - 1], am_ende ? trenner : "");
}


x86 assembly (clang, -O0):
<schreibe_double_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8b,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
and    $0x1,%al
mov    %al,-0x19(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1176 <schreibe_double_array+0x66>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rdx
lea    0xe9f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1135 <schreibe_double_array+0x25>
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
testb  $0x1,-0x19(%rbp)
je     11aa <schreibe_double_array+0x9a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    11ba <schreibe_double_array+0xaa>
lea    0xe55(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    11ba <schreibe_double_array+0xaa>
movsd  -0x28(%rbp),%xmm0
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rdx
lea    0xe33(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<schreibe_double_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,0x4(%rsp)
mov    %rcx,%rbx
mov    %edx,%r15d
mov    %rdi,%rbp
lea    -0x1(%rsi),%eax
mov    %eax,(%rsp)
cmp    $0x2,%esi
jl     1170 <schreibe_double_array+0x60>
mov    (%rsp),%r14d
xor    %r13d,%r13d
lea    0xebe(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x0(%rbp,%r13,8),%xmm0
mov    %r12,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x1,%r13
cmp    %r13,%r14
jne    1150 <schreibe_double_array+0x40>
movslq (%rsp),%rax
movsd  0x0(%rbp,%rax,8),%xmm0
lea    0xe85(%rip),%rdx
cmpb   $0x0,0x4(%rsp)
cmovne %rbx,%rdx
lea    0xe6f(%rip),%rdi
mov    %r15d,%esi
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"%*lf%s\00"
@.str.1 = [1 x i8] zeroinitializer
define void @schreibe_double_array(double* nocapture %0, i32 %1, i32 %2, i8* %3, i1 zeroext %4) {
%6 = add i32 %1, -1
%7 = icmp sgt i32 %1, 1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = zext i32 %6 to i64
br label %16
10: ; preds = %16, %5
%11 = sext i32 %6 to i64
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = load double, double* %12
%14 = select i1 %4, i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2, double %13, i8* %14)
ret void
16: ; preds = %8, %16
%17 = phi i64 [ 0, %8 ], [ %21, %16 ]
%18 = getelementptr inbounds double, double* %0, i64 %17
%19 = load double, double* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2, double %19, i8* %3)
%21 = add nuw nsw i64 %17, 1
%22 = icmp eq i64 %21, %9
br i1 %22, label %10, label %16
}