#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*/ printf(char *, ...);
void prt1a(char *t1, double *v, int n, char *t2) {
  int j;
  printf("%s", t1);
  for (j = 0; j < n; j++)
    printf("%.4g%s", v[j], j % 10 == 9 ? "\n" : ", ");
  printf("%s", t2);
}


x86 assembly (clang, -O0):
<prt1a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1195 <prt1a+0x85>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x24(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
lea    0xe9e(%rip),%rsi
lea    0xe95(%rip),%rax
cmp    $0x9,%edx
cmove  %rax,%rsi
lea    0xe80(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1140 <prt1a+0x30>
mov    -0x20(%rbp),%rsi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prt1a>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,(%rsp)
mov    %edx,%r15d
mov    %rsi,%r12
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
test   %r15d,%r15d
jle    11a7 <prt1a+0x97>
mov    %r15d,%r13d
shl    $0x3,%r13
mov    $0x9,%ebx
lea    0xeb0(%rip),%r15
xor    %r14d,%r14d
jmp    117f <prt1a+0x6f>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%r12,%r14,1),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x8,%r14
add    $0xffffffff,%ebx
add    $0x1,%ebp
cmp    %r14,%r13
je     11a7 <prt1a+0x97>
mov    %ebp,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
add    %eax,%eax
lea    0xe6d(%rip),%rsi
add    %ebx,%eax
je     1160 <prt1a+0x50>
lea    0xe64(%rip),%rsi
jmp    1160 <prt1a+0x50>
lea    0xe56(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"%.4g%s\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c", \00"
define void @prt1a(i8* %0, double* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store double* %1, double** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
store i32 0, i32* %9
br label %12
12: ; preds = %28, %4
%13 = load i32, i32* %9
%14 = load i32, i32* %7
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load double*, double** %6
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = load i32, i32* %9
%23 = srem i32 %22, 10
%24 = icmp eq i32 %23, 9
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %21, i8* %26)
br label %28
28: ; preds = %16
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %12
31: ; preds = %12
%32 = load i8*, i8** %8
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %32)
ret void
}

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