#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*/ memcpy(int *, int *, int);
int /*<<< orphan*/ subset_it_idx_for_id(int /*<<< orphan*/, int, int *, int);
scalar_t__ subset_it_next_explicit(int, int, int *);
void subset_it_compute_all(int n, int k, int *res) {
  int temp[k];
  subset_it_idx_for_id(0, n, temp, k);
  do {
    memcpy(res, temp, k * sizeof(int));
    res += k;
  } while (subset_it_next_explicit(n, k, temp));
}


x86 assembly (clang, -O0):
<subset_it_compute_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%ecx
xor    %edi,%edi
call   1050 <subset_it_idx_for_id@plt>
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rdx
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <subset_it_next_explicit@plt>
cmp    $0x0,%rax
jne    1176 <subset_it_compute_all+0x46>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subset_it_compute_all>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %edi,%esi
mov    %r15d,%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
xor    %edi,%edi
mov    %esi,-0x2c(%rbp)
mov    %r12,%rdx
mov    %r15d,%ecx
call   1050 <subset_it_idx_for_id@plt>
mov    %r15d,%r14d
movslq %r15d,%r15
lea    0x0(,%r15,4),%r13d
shl    $0x2,%r15
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1030 <memcpy@plt>
mov    -0x2c(%rbp),%edi
mov    %r14d,%esi
mov    %r12,%rdx
call   1040 <subset_it_next_explicit@plt>
add    %r15,%rbx
test   %rax,%rax
jne    1180 <subset_it_compute_all+0x50>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @subset_it_compute_all(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i32, i64 %10
store i64 %10, i64* %8
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @subset_it_idx_for_id(i32 0, i32 %13, i32* %12, i32 %14)
br label %16
16: ; preds = %27, %3
%17 = load i32*, i32** %6
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = mul i64 %19, 4
%21 = trunc i64 %20 to i32
%22 = call i32 @memcpy(i32* %17, i32* %12, i32 %21)
%23 = load i32, i32* %5
%24 = load i32*, i32** %6
%25 = sext i32 %23 to i64
%26 = getelementptr inbounds i32, i32* %24, i64 %25
store i32* %26, i32** %6
br label %27
27: ; preds = %16
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = call i64 @subset_it_next_explicit(i32 %28, i32 %29, i32* %12)
%31 = icmp ne i64 %30, 0
br i1 %31, label %16, label %32
32: ; preds = %27
%33 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
define void @subset_it_compute_all(i32 %0, i32 %1, i32* %2) {
%4 = zext i32 %1 to i64
%5 = alloca i32, i64 %4
%6 = call i32 @subset_it_idx_for_id(i32 0, i32 %0, i32* %5, i32 %1)
%7 = sext i32 %1 to i64
%8 = shl i32 %1, 2
br label %9
9: ; preds = %9, %3
%10 = phi i32* [ %2, %3 ], [ %12, %9 ]
%11 = call i32 @memcpy(i32* %10, i32* %5, i32 %8)
%12 = getelementptr inbounds i32, i32* %10, i64 %7
%13 = call i64 @subset_it_next_explicit(i32 %0, i32 %1, i32* %5)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %9
15: ; preds = %9
ret void
}