#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 *, int, int /*<<< orphan*/);
int /*<<< orphan*/ running_dynamic(int, unsigned long *);
int main() {
  int steps[10] = {1, 2, 3, 4, 8, 10, 20, 25, 32, 36};
  unsigned long map[37] = {0};
  int n;
  for (n = 0; n < 10; n++) {
    printf("%d: %ld\n", steps[n], running_dynamic(steps[n], map));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
lea    -0x160(%rbp),%rdi
xor    %esi,%esi
mov    $0x128,%edx
call   1050 <memset@plt>
movl   $0x0,-0x164(%rbp)
cmpl   $0xa,-0x164(%rbp)
jge    11e1 <main+0xa1>
movslq -0x164(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x168(%rbp)
movslq -0x164(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
lea    -0x160(%rbp),%rsi
call   1030 <running_dynamic@plt>
mov    -0x168(%rbp),%esi
mov    %eax,%edx
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1184 <main+0x44>
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x128,%rsp
mov    %rsp,%rbx
mov    $0x128,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
lea    0xea0(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x4,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x8,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
mov    %r14,%rdi
mov    $0x8,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
mov    %r14,%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x14,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
mov    %r14,%rdi
mov    $0x14,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x19,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
mov    %r14,%rdi
mov    $0x19,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
mov    %r14,%rdi
mov    $0x20,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x24,%edi
mov    %rbx,%rsi
call   1030 <running_dynamic@plt>
mov    %r14,%rdi
mov    $0x24,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%d: %ld\0A\00"
define i32 @main() {
%1 = alloca [37 x i64]
%2 = bitcast [37 x i64]* %1 to i8*
%3 = getelementptr inbounds [37 x i64], [37 x i64]* %1, i64 0, i64 0
%4 = call i32 @running_dynamic(i32 1, i64* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 %4)
%6 = call i32 @running_dynamic(i32 2, i64* %3)
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 2, i32 %6)
%8 = call i32 @running_dynamic(i32 3, i64* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 3, i32 %8)
%10 = call i32 @running_dynamic(i32 4, i64* %3)
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 4, i32 %10)
%12 = call i32 @running_dynamic(i32 8, i64* %3)
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8, i32 %12)
%14 = call i32 @running_dynamic(i32 10, i64* %3)
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 10, i32 %14)
%16 = call i32 @running_dynamic(i32 20, i64* %3)
%17 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 20, i32 %16)
%18 = call i32 @running_dynamic(i32 25, i64* %3)
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 25, i32 %18)
%20 = call i32 @running_dynamic(i32 32, i64* %3)
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 32, i32 %20)
%22 = call i32 @running_dynamic(i32 36, i64* %3)
%23 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 36, i32 %22)
ret i32 0
}