#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*/ assert(int);
int /*<<< orphan*/ int2bin(int);
scalar_t__ strcmp(char *, int /*<<< orphan*/);
void test_int2bin() {
  assert(strcmp("00000000000000000000000000000000", int2bin(0)) == 0);
  assert(strcmp("00000000000000000000000001111111", int2bin(127)) == 0);
  assert(strcmp("00000000000000000000000001111110", int2bin(126)) == 0);
  assert(strcmp("00000000000000000000000000000010", int2bin(2)) == 0);
  assert(strcmp("00000000000000000000000000000001", int2bin(1)) == 0);
  assert(strcmp("11111111111111111111111111111111", int2bin(-1)) == 0);
  assert(strcmp("11111111111111111111111111111110", int2bin(-2)) == 0);
  assert(strcmp("11111111111111111111111110000010", int2bin(-126)) == 0);
  assert(strcmp("11111111111111111111111110000001", int2bin(-127)) == 0);
  assert(strcmp("11111111111111111111111110000000", int2bin(-128)) == 0);
}


x86 assembly (clang, -O0):
<test_int2bin>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xebc(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x7f,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x7e,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x2,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xea4(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0xffffffff,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xe94(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0xfffffffe,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0xffffff82,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xe84(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0xffffff81,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xe7c(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0xffffff80,%edi
call   1030 <int2bin@plt>
mov    %eax,%esi
lea    0xe74(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_int2bin>:
push   %rax
xor    %edi,%edi
call   1030 <int2bin@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0x7f,%edi
call   1030 <int2bin@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0x7e,%edi
call   1030 <int2bin@plt>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0x2,%edi
call   1030 <int2bin@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0x1,%edi
call   1030 <int2bin@plt>
lea    0xead(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0xffffffff,%edi
call   1030 <int2bin@plt>
lea    0xea8(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0xfffffffe,%edi
call   1030 <int2bin@plt>
lea    0xea3(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0xffffff82,%edi
call   1030 <int2bin@plt>
lea    0xe9e(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0xffffff81,%edi
call   1030 <int2bin@plt>
lea    0xe99(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0xffffff80,%edi
call   1030 <int2bin@plt>
lea    0xe94(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
pop    %rax
jmp    1050 <assert@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"00000000000000000000000000000000\00"
@.str.1 = [33 x i8] c"00000000000000000000000001111111\00"
@.str.2 = [33 x i8] c"00000000000000000000000001111110\00"
@.str.3 = [33 x i8] c"00000000000000000000000000000010\00"
@.str.4 = [33 x i8] c"00000000000000000000000000000001\00"
@.str.5 = [33 x i8] c"11111111111111111111111111111111\00"
@.str.6 = [33 x i8] c"11111111111111111111111111111110\00"
@.str.7 = [33 x i8] c"11111111111111111111111110000010\00"
@.str.8 = [33 x i8] c"11111111111111111111111110000001\00"
@.str.9 = [33 x i8] c"11111111111111111111111110000000\00"
define void @test_int2bin() {
%1 = call i32 @int2bin(i32 0)
%2 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i32 @int2bin(i32 127)
%7 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @int2bin(i32 126)
%12 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @int2bin(i32 2)
%17 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @int2bin(i32 1)
%22 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 @int2bin(i32 -1)
%27 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %26)
%28 = icmp eq i64 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = call i32 @int2bin(i32 -2)
%32 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %31)
%33 = icmp eq i64 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call i32 @int2bin(i32 -126)
%37 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %36)
%38 = icmp eq i64 %37, 0
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = call i32 @int2bin(i32 -127)
%42 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i32 %41)
%43 = icmp eq i64 %42, 0
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = call i32 @int2bin(i32 -128)
%47 = call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i32 %46)
%48 = icmp eq i64 %47, 0
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"00000000000000000000000000000000\00"
@.str.1 = [33 x i8] c"00000000000000000000000001111111\00"
@.str.2 = [33 x i8] c"00000000000000000000000001111110\00"
@.str.3 = [33 x i8] c"00000000000000000000000000000010\00"
@.str.4 = [33 x i8] c"00000000000000000000000000000001\00"
@.str.5 = [33 x i8] c"11111111111111111111111111111111\00"
@.str.6 = [33 x i8] c"11111111111111111111111111111110\00"
@.str.7 = [33 x i8] c"11111111111111111111111110000010\00"
@.str.8 = [33 x i8] c"11111111111111111111111110000001\00"
@.str.9 = [33 x i8] c"11111111111111111111111110000000\00"
define void @test_int2bin() {
%1 = tail call i32 @int2bin(i32 0)
%2 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @int2bin(i32 127)
%7 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @int2bin(i32 126)
%12 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @int2bin(i32 2)
%17 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i32 @int2bin(i32 1)
%22 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = tail call i32 @int2bin(i32 -1)
%27 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %26)
%28 = icmp eq i64 %27, 0
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call i32 @int2bin(i32 -2)
%32 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %31)
%33 = icmp eq i64 %32, 0
%34 = zext i1 %33 to i32
%35 = tail call i32 @assert(i32 %34)
%36 = tail call i32 @int2bin(i32 -126)
%37 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %36)
%38 = icmp eq i64 %37, 0
%39 = zext i1 %38 to i32
%40 = tail call i32 @assert(i32 %39)
%41 = tail call i32 @int2bin(i32 -127)
%42 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i32 %41)
%43 = icmp eq i64 %42, 0
%44 = zext i1 %43 to i32
%45 = tail call i32 @assert(i32 %44)
%46 = tail call i32 @int2bin(i32 -128)
%47 = tail call i64 @strcmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i32 %46)
%48 = icmp eq i64 %47, 0
%49 = zext i1 %48 to i32
%50 = tail call i32 @assert(i32 %49)
ret void
}