#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 min(int *, int);
int minTen(int *);
int /*<<< orphan*/ multiplyEach(int, int *, int);
int /*<<< orphan*/ printArray(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int dek[] = {3, 9, 0, 7, -3, 6, 1, 2, 4, 5};
  printf("Simple methods for array:\n");
  printf("  dek[10]      -> ");
  printArray(dek, 10);
  printf("  minTen(dek)  -> %i\n", minTen(dek));
  printf("  min(dek, 10) -> %i\n\n", min(dek, 10));
  printf("Modifying array 'dek'\n\n");
  printf("  Original ->\n    ");
  printArray(dek, 10);
  printf("\n  multiplyEach(2, dek, 10) ->\n    ");
  multiplyEach(2, dek, 10);
  printArray(dek, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1070 <printArray@plt>
lea    -0x30(%rbp),%rdi
call   1080 <minTen@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <min@plt>
mov    %eax,%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1070 <printArray@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
mov    $0x2,%edi
mov    $0xa,%edx
call   1060 <multiplyEach@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1070 <printArray@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xeb4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe7c(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <printArray@plt>
mov    %rbx,%rdi
call   1080 <minTen@plt>
lea    0xe7a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <min@plt>
lea    0xe73(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <printArray@plt>
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1060 <multiplyEach@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <printArray@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.dek = [10 x i32] [i32 3, i32 9, i32 0, i32 7, i32 -3, i32 6, i32 1, i32 2, i32 4, i32 5]
@.str = [27 x i8] c"Simple methods for array:\0A\00"
@.str.1 = [19 x i8] c" dek[10] -> \00"
@.str.2 = [22 x i8] c" minTen(dek) -> %i\0A\00"
@.str.3 = [23 x i8] c" min(dek, 10) -> %i\0A\0A\00"
@.str.4 = [24 x i8] c"Modifying array 'dek'\0A\0A\00"
@.str.5 = [19 x i8] c" Original ->\0A \00"
@.str.6 = [36 x i8] c"\0A multiplyEach(2, dek, 10) ->\0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
store i32 0, i32* %1
%3 = bitcast [10 x i32]* %2 to i8*
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = call i32 @printArray(i32* %6, i32 10)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = call i32 @minTen(i32* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%12 = call i32 @min(i32* %11, i32 10)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%17 = call i32 @printArray(i32* %16, i32 10)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%20 = call i32 @multiplyEach(i32 2, i32* %19, i32 10)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%22 = call i32 @printArray(i32* %21, i32 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.dek = [10 x i32] [i32 3, i32 9, i32 0, i32 7, i32 -3, i32 6, i32 1, i32 2, i32 4, i32 5]
@.str.1 = [19 x i8] c" dek[10] -> \00"
@.str.2 = [22 x i8] c" minTen(dek) -> %i\0A\00"
@.str.3 = [23 x i8] c" min(dek, 10) -> %i\0A\0A\00"
@.str.5 = [19 x i8] c" Original ->\0A \00"
@.str.6 = [36 x i8] c"\0A multiplyEach(2, dek, 10) ->\0A \00"
@str = [26 x i8] c"Simple methods for array:\00"
@str.7 = [23 x i8] c"Modifying array 'dek'\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = call i32 @printArray(i32* %5, i32 10)
%7 = call i32 @minTen(i32* %5)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = call i32 @min(i32* %5, i32 10)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.7, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @printArray(i32* %5, i32 10)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @multiplyEach(i32 2, i32* %5, i32 10)
%16 = call i32 @printArray(i32* %5, i32 10)
ret i32 0
}