#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 *, ...);
void print_diffs(unsigned diff, const char name[]) {
  if (diff) {
    int i;
    printf("%s: ", name);
    for (i = 0; i < 32; i++)
      if (diff >> i & 1)
        printf("%d ", i);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_diffs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1192 <print_diffs+0x82>
mov    -0x10(%rbp),%rsi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
jge    1184 <print_diffs+0x74>
mov    -0x4(%rbp),%eax
mov    -0x14(%rbp),%ecx
shr    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1171 <print_diffs+0x61>
mov    -0x14(%rbp),%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1176 <print_diffs+0x66>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <print_diffs+0x32>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_diffs>:
test   %edi,%edi
je     1179 <print_diffs+0x59>
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec6(%rip),%r14
xor    %ebp,%ebp
jmp    1158 <print_diffs+0x38>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
cmp    $0x20,%ebp
je     116b <print_diffs+0x4b>
bt     %ebp,%ebx
jae    1150 <print_diffs+0x30>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <print_diffs+0x30>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>
ret

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

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