#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 set {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ set_get(struct set const *, int);
void set_fprint(const struct set *S, FILE *stream) {
  int i = 0;
  fprintf(stream, "[ ");
  for (i = 0; i < sizeof(int) * 8; i++) {
    if (set_get(S, i))
      fprintf(stream, "%d ", i);
  }
  fprintf(stream, "]");
  fflush(stream);
}


x86 assembly (clang, -O0):
<set_fprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x20,%rax
jae    11ac <set_fprint+0x7c>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <set_get@plt>
cmp    $0x0,%rax
je     1199 <set_fprint+0x69>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    119e <set_fprint+0x6e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <set_fprint+0x30>
mov    -0x10(%rbp),%rdi
lea    0xe50(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_fprint>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe9c(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1060 <fwrite@plt>
lea    0xe86(%rip),%r15
xor    %ebp,%ebp
jmp    1198 <set_fprint+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x20,%ebp
je     11b8 <set_fprint+0x68>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1070 <set_get@plt>
test   %rax,%rax
je     1190 <set_fprint+0x40>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1190 <set_fprint+0x40>
mov    $0x5d,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
%struct.set = type { i32 }
@.str = [3 x i8] c"[ \00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"]\00"
define void @set_fprint(%struct.set* %0, i32* %1) {
%3 = alloca %struct.set*
%4 = alloca i32*
%5 = alloca i32
store %struct.set* %0, %struct.set** %3
store i32* %1, i32** %4
store i32 0, i32* %5
%6 = load i32*, i32** %4
%7 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %8
8: ; preds = %22, %2
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 32
br i1 %11, label %12, label %25
12: ; preds = %8
%13 = load %struct.set*, %struct.set** %3
%14 = load i32, i32* %5
%15 = call i64 @set_get(%struct.set* %13, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %17, %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %8
25: ; preds = %8
%26 = load i32*, i32** %4
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32*, i32** %4
%29 = call i32 @fflush(i32* %28)
ret void
}

LLVM IR (-O2):
%struct.set = type { i32 }
@.str = [3 x i8] c"[ \00"
@.str.1 = [4 x i8] c"%d \00"
define void @set_fprint(%struct.set* %0, i32* nocapture %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %1)
br label %4
4: ; preds = %2, %10
%5 = phi i32 [ 0, %2 ], [ %11, %10 ]
%6 = tail call i64 @set_get(%struct.set* %0, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
br label %10
10: ; preds = %4, %8
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %11, 32
br i1 %12, label %13, label %4
13: ; preds = %10
%14 = tail call i32 @fputc(i32 93, i32* %1)
%15 = tail call i32 @fflush(i32* %1)
ret void
}