#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 aml_array_int_2d_variable_2nd_save(FILE *file, int **arr, int s1,
                                        int *s2) {
  int i, j;
  for (i = 0; i < s1; i++) {
    for (j = 0; j < s2[i]; j++)
      fprintf(file, "%d ", arr[i][j]);
    fprintf(file, "\n");
  }
}


x86 assembly (clang, -O0):
<aml_array_int_2d_variable_2nd_save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a8 <aml_array_int_2d_variable_2nd_save+0x98>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x20(%rbp),%rcx
movslq -0x24(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1188 <aml_array_int_2d_variable_2nd_save+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1141 <aml_array_int_2d_variable_2nd_save+0x31>
mov    -0x8(%rbp),%rdi
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112e <aml_array_int_2d_variable_2nd_save+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aml_array_int_2d_variable_2nd_save>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    11a4 <aml_array_int_2d_variable_2nd_save+0x84>
mov    %rcx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,%eax
mov    %rax,(%rsp)
lea    0xebb(%rip),%r12
xor    %ebp,%ebp
jmp    1167 <aml_array_int_2d_variable_2nd_save+0x47>
nopl   0x0(%rax)
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
add    $0x1,%rbp
cmp    (%rsp),%rbp
je     11a4 <aml_array_int_2d_variable_2nd_save+0x84>
cmpl   $0x0,(%r15,%rbp,4)
jle    1150 <aml_array_int_2d_variable_2nd_save+0x30>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbp,8),%rax
mov    (%rax,%r13,4),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%r13
movslq (%r15,%rbp,4),%rax
cmp    %rax,%r13
jl     1180 <aml_array_int_2d_variable_2nd_save+0x60>
jmp    1150 <aml_array_int_2d_variable_2nd_save+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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