#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*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
void listsubsets(char *element, char *subset) {
  if (*subset == 0) {
    printf("{%s}\n", element);
  } else {
    int i;
    char *tmpset = subset;
    for (i = 0; i <= strlen(subset); i++, tmpset++) {
      char buf[10];
      memset(buf, 0, 10);
      strcpy(buf, element);
      buf[strlen(buf)] = *tmpset;
      buf[strlen(buf)] = 0;
      if (*tmpset == 0) {
        listsubsets(buf, tmpset);
      } else {
        listsubsets(buf, tmpset + 1);
      }
    }
  }
}


x86 assembly (clang, -O0):
<listsubsets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1185 <listsubsets+0x35>
mov    -0x8(%rbp),%rsi
lea    0xe85(%rip),%rdi
call   1060 <printf@plt>
jmp    1250 <listsubsets+0x100>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
ja     124b <listsubsets+0xfb>
lea    -0x2a(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <memset@plt>
lea    -0x2a(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x39(%rbp)
lea    -0x2a(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x39(%rbp),%cl
mov    %cl,-0x2a(%rbp,%rax,1)
lea    -0x2a(%rbp),%rdi
call   1050 <strlen@plt>
movb   $0x0,-0x2a(%rbp,%rax,1)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    121b <listsubsets+0xcb>
lea    -0x2a(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <listsubsets@plt>
jmp    122c <listsubsets+0xdc>
lea    -0x2a(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
call   1040 <listsubsets@plt>
jmp    1231 <listsubsets+0xe1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1194 <listsubsets+0x44>
jmp    1250 <listsubsets+0x100>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listsubsets>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
cmpb   $0x0,(%rsi)
je     11e0 <listsubsets+0x90>
mov    %rsi,%r12
xor    %ebx,%ebx
lea    0x6(%rsp),%r15
xchg   %ax,%ax
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <memset@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
movzbl (%r12,%rbx,1),%ebp
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %bpl,0x6(%rsp,%rax,1)
mov    %r15,%rdi
call   1050 <strlen@plt>
movb   $0x0,0x6(%rsp,%rax,1)
cmp    $0x1,%bpl
mov    %rbx,%rsi
sbb    $0xffffffffffffffff,%rsi
add    %r12,%rsi
mov    %r15,%rdi
call   1040 <listsubsets@plt>
lea    0x1(%rbx),%rbp
mov    %r12,%rdi
call   1050 <strlen@plt>
cmp    %rbx,%rax
mov    %rbp,%rbx
ja     1170 <listsubsets+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe19(%rip),%rdi
mov    %r14,%rsi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"{%s}\0A\00"
define void @listsubsets(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [10 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %55
15: ; preds = %2
%16 = load i8*, i8** %4
store i8* %16, i8** %6
store i32 0, i32* %5
br label %17
17: ; preds = %49, %15
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = load i8*, i8** %4
%21 = call i64 @strlen(i8* %20)
%22 = icmp ule i64 %19, %21
br i1 %22, label %23, label %54
23: ; preds = %17
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%25 = call i32 @memset(i8* %24, i32 0, i32 10)
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%27 = load i8*, i8** %3
%28 = call i32 @strcpy(i8* %26, i8* %27)
%29 = load i8*, i8** %6
%30 = load i8, i8* %29
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%32 = call i64 @strlen(i8* %31)
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %32
store i8 %30, i8* %33
%34 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%35 = call i64 @strlen(i8* %34)
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %35
store i8 0, i8* %36
%37 = load i8*, i8** %6
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %23
%42 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%43 = load i8*, i8** %6
br label %48
44: ; preds = %23
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%46 = load i8*, i8** %6
%47 = getelementptr inbounds i8, i8* %46, i64 1
br label %48
48: ; preds = %44, %41
br label %49
49: ; preds = %48
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
%52 = load i8*, i8** %6
%53 = getelementptr inbounds i8, i8* %52, i32 1
store i8* %53, i8** %6
br label %17
54: ; preds = %17
br label %55
55: ; preds = %54, %12
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"{%s}\0A\00"
define void @listsubsets(i8* %0, i8* %1) {
%3 = alloca [10 x i8]
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
br label %10
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %27
10: ; preds = %6, %10
%11 = phi i64 [ 0, %6 ], [ %23, %10 ]
%12 = phi i8* [ %1, %6 ], [ %24, %10 ]
%13 = call i32 @memset(i8* %7, i32 0, i32 10)
%14 = call i32 @strcpy(i8* %7, i8* %0)
%15 = load i8, i8* %12
%16 = call i64 @strlen(i8* %7)
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %16
store i8 %15, i8* %17
%18 = call i64 @strlen(i8* %7)
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %18
store i8 0, i8* %19
%20 = icmp ne i8 %15, 0
%21 = zext i1 %20 to i64
%22 = getelementptr i8, i8* %12, i64 %21
%23 = add nuw i64 %11, 1
%24 = getelementptr inbounds i8, i8* %12, i64 1
%25 = call i64 @strlen(i8* %1)
%26 = icmp ugt i64 %25, %11
br i1 %26, label %10, label %27
27: ; preds = %10, %8
ret void
}