char *b2s(bin)
unsigned int bin;
{
  static char bite[17];
  int i, ii;
  i = 16;
  ii = 0;
  while (i > 0) {
    bite[--i] = ((bin & (0x01 << ii++)) != 0) + '0';
  }
  bite[16] = '\0';
  return (bite);
}


x86 assembly (clang, -O0):
<b2s>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x10,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1163 <b2s+0x63>
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%eax
mov    %al,%dl
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2ed5(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    1115 <b2s+0x15>
movb   $0x0,0x2ed6(%rip)
lea    0x2ebf(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b2s>:
mov    %edi,%eax
and    $0x1,%al
or     $0x30,%al
mov    %al,0x2f33(%rip)
lea    0x2f1d(%rip),%rax
mov    %edi,%ecx
shr    %cl
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2f1b(%rip)
mov    %edi,%ecx
shr    $0x2,%cl
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2f09(%rip)
mov    %edi,%ecx
shr    $0x3,%cl
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2ef7(%rip)
mov    %edi,%ecx
shr    $0x4,%cl
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2ee5(%rip)
mov    %edi,%ecx
shr    $0x5,%cl
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2ed3(%rip)
mov    %edi,%ecx
shr    $0x6,%cl
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2ec1(%rip)
mov    %edi,%ecx
shr    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2eb2(%rip)
mov    %edi,%ecx
shr    $0x8,%ecx
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2ea0(%rip)
mov    %edi,%ecx
shr    $0x9,%ecx
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2e8e(%rip)
mov    %edi,%ecx
shr    $0xa,%ecx
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2e7c(%rip)
mov    %edi,%ecx
shr    $0xb,%ecx
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2e6a(%rip)
mov    %edi,%ecx
shr    $0xc,%ecx
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2e58(%rip)
mov    %edi,%ecx
shr    $0xd,%ecx
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2e46(%rip)
mov    %edi,%ecx
shr    $0xe,%ecx
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,0x2e34(%rip)
shr    $0xf,%edi
and    $0x1,%dil
or     $0x30,%dil
mov    %dil,0x2e21(%rip)
movb   $0x0,0x2e2a(%rip)
ret

LLVM IR (-O0):
@b2s.bite = internal global [17 x i8] zeroinitializer
define i8* @b2s(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 16, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %8, %1
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
%12 = shl i32 1, %10
%13 = and i32 %9, %12
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i32
%16 = add nsw i32 %15, 48
%17 = trunc i32 %16 to i8
%18 = load i32, i32* %3
%19 = add nsw i32 %18, -1
store i32 %19, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 %20
store i8 %17, i8* %21
br label %5
22: ; preds = %5
store i8 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 16)
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 0)
}

LLVM IR (-O2):
@b2s.bite = internal global [17 x i8] zeroinitializer
define i8* @b2s(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = and i8 %2, 1
%4 = or i8 %3, 48
store i8 %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 15)
%5 = trunc i32 %0 to i8
%6 = lshr i8 %5, 1
%7 = and i8 %6, 1
%8 = or i8 %7, 48
store i8 %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 14)
%9 = trunc i32 %0 to i8
%10 = lshr i8 %9, 2
%11 = and i8 %10, 1
%12 = or i8 %11, 48
store i8 %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 13)
%13 = trunc i32 %0 to i8
%14 = lshr i8 %13, 3
%15 = and i8 %14, 1
%16 = or i8 %15, 48
store i8 %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 12)
%17 = trunc i32 %0 to i8
%18 = lshr i8 %17, 4
%19 = and i8 %18, 1
%20 = or i8 %19, 48
store i8 %20, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 11)
%21 = trunc i32 %0 to i8
%22 = lshr i8 %21, 5
%23 = and i8 %22, 1
%24 = or i8 %23, 48
store i8 %24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 10)
%25 = trunc i32 %0 to i8
%26 = lshr i8 %25, 6
%27 = and i8 %26, 1
%28 = or i8 %27, 48
store i8 %28, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 9)
%29 = trunc i32 %0 to i8
%30 = lshr i8 %29, 7
%31 = or i8 %30, 48
store i8 %31, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 8)
%32 = lshr i32 %0, 8
%33 = trunc i32 %32 to i8
%34 = and i8 %33, 1
%35 = or i8 %34, 48
store i8 %35, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 7)
%36 = lshr i32 %0, 9
%37 = trunc i32 %36 to i8
%38 = and i8 %37, 1
%39 = or i8 %38, 48
store i8 %39, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 6)
%40 = lshr i32 %0, 10
%41 = trunc i32 %40 to i8
%42 = and i8 %41, 1
%43 = or i8 %42, 48
store i8 %43, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 5)
%44 = lshr i32 %0, 11
%45 = trunc i32 %44 to i8
%46 = and i8 %45, 1
%47 = or i8 %46, 48
store i8 %47, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 4)
%48 = lshr i32 %0, 12
%49 = trunc i32 %48 to i8
%50 = and i8 %49, 1
%51 = or i8 %50, 48
store i8 %51, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 3)
%52 = lshr i32 %0, 13
%53 = trunc i32 %52 to i8
%54 = and i8 %53, 1
%55 = or i8 %54, 48
store i8 %55, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 2)
%56 = lshr i32 %0, 14
%57 = trunc i32 %56 to i8
%58 = and i8 %57, 1
%59 = or i8 %58, 48
store i8 %59, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 1)
%60 = lshr i32 %0, 15
%61 = trunc i32 %60 to i8
%62 = and i8 %61, 1
%63 = or i8 %62, 48
store i8 %63, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 16)
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @b2s.bite, i64 0, i64 0)
}