#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 get_min_steps_bu(int, int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int num = 52;
  int *memo = (int *)malloc((num + 1) * sizeof(int));
  int c;
  for (c = 0; c <= num; c++) {
    memo[c] = -1;
  }
  printf("%d : %d\n", num, get_min_steps_bu(num, memo));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x34,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     118d <main+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1164 <main+0x34>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <get_min_steps_bu@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xd4,%edi
call   1050 <malloc@plt>
pcmpeqd %xmm0,%xmm0
movdqu %xmm0,(%rax)
movdqu %xmm0,0x10(%rax)
movdqu %xmm0,0x20(%rax)
movdqu %xmm0,0x30(%rax)
movdqu %xmm0,0x40(%rax)
movdqu %xmm0,0x50(%rax)
movdqu %xmm0,0x60(%rax)
movdqu %xmm0,0x70(%rax)
movdqu %xmm0,0x80(%rax)
movdqu %xmm0,0x90(%rax)
movdqu %xmm0,0xa0(%rax)
movdqu %xmm0,0xb0(%rax)
movdqu %xmm0,0xc0(%rax)
movl   $0xffffffff,0xd0(%rax)
ff ff ff
mov    $0x34,%edi
mov    %rax,%rsi
call   1040 <get_min_steps_bu@plt>
lea    0xe54(%rip),%rdi
mov    $0x34,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%d : %d\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 212)
%2 = inttoptr i64 %1 to i32*
%3 = inttoptr i64 %1 to i8*
%4 = tail call i32 @get_min_steps_bu(i32 52, i32* %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 52, i32 %4)
ret i32 0
}