#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 atoi(char *);
int /*<<< orphan*/ print_volume(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sphere_volume(int);
extern int main(int argc, char *argv[]) {
  int dim, max_dims = 9;
  if (2 == argc)
    max_dims = atoi(argv[1]);
  printf("static const double sphere_volumes[] = {\n");
  for (dim = 0; dim < max_dims + 1; dim++)
    print_volume(dim, sphere_volume(dim));
  printf("};\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x9,-0x18(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
jne    117b <main+0x3b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11c5 <main+0x85>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <sphere_volume@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1050 <print_volume@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118e <main+0x4e>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    116c <main+0x2c>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x7ffffffe,%ebx
ja     1197 <main+0x57>
add    $0x1,%ebx
jmp    117d <main+0x3d>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%ebx
xor    %ebp,%ebp
nop
mov    %ebp,%edi
call   1040 <sphere_volume@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <print_volume@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1180 <main+0x40>
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"static const double sphere_volumes[] = {\0A\00"
@.str.1 = [4 x i8] c"};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 9, i32* %7
%8 = load i32, i32* %4
%9 = icmp eq i32 2, %8
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %7
br label %15
15: ; preds = %10, %2
%16 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %17
17: ; preds = %27, %15
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %30
22: ; preds = %17
%23 = load i32, i32* %6
%24 = load i32, i32* %6
%25 = call i32 @sphere_volume(i32 %24)
%26 = call i32 @print_volume(i32 %23, i32 %25)
br label %27
27: ; preds = %22
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %17
30: ; preds = %17
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [41 x i8] c"static const double sphere_volumes[] = {\00"
@str.2 = [3 x i8] c"};\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %13
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = add i32 %9, 1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%12 = icmp ult i32 %9, 2147483647
br i1 %12, label %13, label %21
13: ; preds = %4, %6
%14 = phi i32 [ 10, %4 ], [ %10, %6 ]
br label %15
15: ; preds = %13, %15
%16 = phi i32 [ %19, %15 ], [ 0, %13 ]
%17 = tail call i32 @sphere_volume(i32 %16)
%18 = tail call i32 @print_volume(i32 %16, i32 %17)
%19 = add nuw nsw i32 %16, 1
%20 = icmp eq i32 %19, %14
br i1 %20, label %21, label %15
21: ; preds = %15, %6
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}