#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 */
struct timeval {
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ getCombination(int *, int, int);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printArray(int *, int);
int /*<<< orphan*/ printf(char *, scalar_t__);
int main(void) {
  struct timeval stop, start;
  gettimeofday(&start, NULL);
  int numbers[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  getCombination(numbers, 10, 1000000);
  printArray(numbers, 10);
  gettimeofday(&stop, NULL);
  printf("\ntook %lu usec\n", stop.tv_usec - start.tv_usec);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
lea    -0x40(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
mov    $0xf4240,%edx
call   1070 <getCombination@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1060 <printArray@plt>
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x10(%rbp),%rsi
sub    -0x18(%rbp),%rsi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    0xeca(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xeae(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe92(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0xf4240,%edx
call   1060 <getCombination@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <printArray@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    0x8(%rsp),%rsi
sub    (%rsp),%rsi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
@__const.main.numbers = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@.str = [16 x i8] c"\0Atook %lu usec\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = alloca %struct.timeval
%4 = alloca [10 x i32]
store i32 0, i32* %1
%5 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%6 = bitcast [10 x i32]* %4 to i8*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%8 = call i32 @getCombination(i32* %7, i32 10, i32 1000000)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%10 = call i32 @printArray(i32* %9, i32 10)
%11 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%13 = load i64, i64* %12
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%15 = load i64, i64* %14
%16 = sub nsw i64 %13, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %16)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
@__const.main.numbers = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@.str = [16 x i8] c"\0Atook %lu usec\0A\00"
define i32 @main() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timeval
%3 = alloca [10 x i32]
%4 = bitcast %struct.timeval* %1 to i8*
%5 = bitcast %struct.timeval* %2 to i8*
%6 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%7 = bitcast [10 x i32]* %3 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%9 = call i32 @getCombination(i32* %8, i32 10, i32 1000000)
%10 = call i32 @printArray(i32* %8, i32 10)
%11 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%13 = load i64, i64* %12
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%15 = load i64, i64* %14
%16 = sub nsw i64 %13, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %16)
ret i32 0
}