#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 find_min_number_of_slices(int *);
int /*<<< orphan*/ free_2d_array(int **);
int **get_slices();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int **slices = get_slices();
  int i = 0;
  while (slices[i][0]) {
    printf("%i\n", find_min_number_of_slices(slices[i]));
    i++;
  }
  free_2d_array(slices);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <get_slices@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmpl   $0x0,(%rax)
je     11a3 <main+0x63>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <find_min_number_of_slices@plt>
mov    %eax,%esi
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <main+0x21>
mov    -0x10(%rbp),%rdi
call   1060 <free_2d_array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <get_slices@plt>
mov    %rax,%r14
mov    (%rax),%rdi
cmpl   $0x0,(%rdi)
je     118b <main+0x4b>
mov    %r14,%rbx
add    $0x8,%rbx
lea    0xe9b(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <find_min_number_of_slices@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
cmpl   $0x0,(%rdi)
jne    1170 <main+0x30>
mov    %r14,%rdi
call   1060 <free_2d_array@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32**
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32** (...) @get_slices()
store i32** %4, i32*** %2
store i32 0, i32* %3
br label %5
5: ; preds = %14, %0
%6 = load i32**, i32*** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32*, i32** %6, i64 %8
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %5
%15 = load i32**, i32*** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32*, i32** %15, i64 %17
%19 = load i32*, i32** %18
%20 = call i32 @find_min_number_of_slices(i32* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %5
24: ; preds = %5
%25 = load i32**, i32*** %2
%26 = call i32 @free_2d_array(i32** %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = tail call i32** (...) @get_slices()
%2 = load i32*, i32** %1
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %0, %5
%6 = phi i64 [ %10, %5 ], [ 0, %0 ]
%7 = phi i32* [ %12, %5 ], [ %2, %0 ]
%8 = tail call i32 @find_min_number_of_slices(i32* %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add nuw i64 %6, 1
%11 = getelementptr inbounds i32*, i32** %1, i64 %10
%12 = load i32*, i32** %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %0
%16 = tail call i32 @free_2d_array(i32** %1)
ret i32 0
}