#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_realnums(int /*<<< orphan*/ *, char *, double *, int,
                                    char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
void fprintf_2d_realnums(FILE *s, char *m1, double **tdarr, int rows, int cols,
                         char *m2) {
  char buff[100];
  int i;
  for (i = 0; i < rows; i++) {
    sprintf(buff, "%s[%d] = ", m1, i);
    fprintf_realnums(s, buff, tdarr[i], cols, m2);
  }
}


x86 assembly (clang, -O0):
<fprintf_2d_realnums>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b2 <fprintf_2d_realnums+0x92>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x94(%rbp),%ecx
lea    0xe8d(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    -0x18(%rbp),%rax
movslq -0x94(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x20(%rbp),%ecx
mov    -0x28(%rbp),%r8
call   1030 <fprintf_realnums@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    114c <fprintf_2d_realnums+0x2c>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprintf_2d_realnums>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,0x8(%rsp)
mov    %r8d,0x4(%rsp)
test   %ecx,%ecx
jle    1185 <fprintf_2d_realnums+0x65>
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
mov    %ecx,%r15d
xor    %ebp,%ebp
lea    0x10(%rsp),%r14
nop
mov    %r14,%rdi
lea    0xea6(%rip),%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
call   1040 <sprintf@plt>
mov    (%r12,%rbp,8),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%r8
call   1030 <fprintf_realnums@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1150 <fprintf_2d_realnums+0x30>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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