#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*/ putchar(char);
void print_subset3(int n) {
  int i, j;
  for (i = 0; i < (1 << n); ++i) {
    for (j = 0; j < n; ++j)
      if (i & (1 << j))
        printf("%3d", j);
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<print_subset3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jge    11b0 <print_subset3+0x90>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1198 <print_subset3+0x78>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1185 <print_subset3+0x65>
mov    -0xc(%rbp),%esi
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
jmp    118a <print_subset3+0x6a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <print_subset3+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <print_subset3+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_subset3>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x1f,%edi
jne    1136 <print_subset3+0x16>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %edi,%r12d
mov    $0x1,%eax
mov    $0x1,%r15d
mov    %r12d,%ecx
shl    %cl,%r15d
cmp    $0x2,%r15d
cmovl  %eax,%r15d
xor    %ebx,%ebx
lea    0xea5(%rip),%r14
jmp    1172 <print_subset3+0x52>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    %r15d,%ebx
je     112d <print_subset3+0xd>
test   %r12d,%r12d
jle    1160 <print_subset3+0x40>
xor    %ebp,%ebp
jmp    1188 <print_subset3+0x68>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %ebp,%r12d
je     1160 <print_subset3+0x40>
bt     %ebp,%ebx
jae    1180 <print_subset3+0x60>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
jmp    1180 <print_subset3+0x60>

LLVM IR (-O0):
@.str = [4 x i8] c"%3d\00"
define void @print_subset3(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %30, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = shl i32 1, %7
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %33
10: ; preds = %5
store i32 0, i32* %4
br label %11
11: ; preds = %25, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %28
15: ; preds = %11
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = shl i32 1, %17
%19 = and i32 %16, %18
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i32, i32* %4
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %21, %15
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %11
28: ; preds = %11
%29 = call i32 @putchar(i8 signext 10)
br label %30
30: ; preds = %28
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %5
33: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%3d\00"
define void @print_subset3(i32 %0) {
%2 = icmp eq i32 %0, 31
br i1 %2, label %23, label %3
3: ; preds = %1
%4 = shl nuw nsw i32 1, %0
%5 = icmp sgt i32 %0, 0
%6 = call i32 @llvm.smax.i32(i32 %4, i32 1)
br label %7
7: ; preds = %3, %19
%8 = phi i32 [ 0, %3 ], [ %21, %19 ]
br i1 %5, label %9, label %19
9: ; preds = %7, %16
%10 = phi i32 [ %17, %16 ], [ 0, %7 ]
%11 = shl nuw i32 1, %10
%12 = and i32 %11, %8
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %16
16: ; preds = %9, %14
%17 = add nuw nsw i32 %10, 1
%18 = icmp eq i32 %17, %0
br i1 %18, label %19, label %9
19: ; preds = %16, %7
%20 = tail call i32 @putchar(i8 signext 10)
%21 = add nuw nsw i32 %8, 1
%22 = icmp eq i32 %21, %6
br i1 %22, label %23, label %7
23: ; preds = %19, %1
ret void
}