#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 strlen(char *);
void int_to_binary(int number, char *word) {
  int i = 0, len = 0, place = 0;
  len = strlen(word);
  for (i = len; i >= 0; i--) {
    place = number >> i;
    if (place & 1)
      word[len - i - 1] = '1';
    else
      word[len - i - 1] = '0';
  }
}


x86 assembly (clang, -O0):
<int_to_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11aa <int_to_binary+0x9a>
mov    -0x4(%rbp),%eax
mov    -0x14(%rbp),%ecx
sar    %cl,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1183 <int_to_binary+0x73>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x31,(%rax,%rcx,1)
jmp    1197 <int_to_binary+0x87>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x30,(%rax,%rcx,1)
jmp    119c <int_to_binary+0x8c>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1146 <int_to_binary+0x36>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_to_binary>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
js     142d <int_to_binary+0x31d>
mov    %eax,%ecx
cmp    $0x7,%eax
jb     1409 <int_to_binary+0x2f9>
lea    0x1(%rcx),%r8
movabs $0x1fffffff0,%r9
movd   %r14d,%xmm8
cmp    $0xf,%eax
jae    1154 <int_to_binary+0x44>
xor    %edi,%edi
jmp    12ff <int_to_binary+0x1ef>
mov    %r8,%rdi
and    %r9,%rdi
pshufd $0x0,%xmm8,%xmm1
xor    %edx,%edx
movdqa 0xe95(%rip),%xmm9
movdqa 0xe9c(%rip),%xmm10
movdqa 0xea3(%rip),%xmm11
movdqa 0xeaa(%rip),%xmm12
movdqa 0xeb1(%rip),%xmm14
movdqa 0xeb9(%rip),%xmm7
pxor   %xmm15,%xmm15
movdqa 0xebb(%rip),%xmm13
mov    %eax,%esi
nopw   0x0(%rax,%rax,1)
movd   %esi,%xmm3
pshufd $0x0,%xmm3,%xmm4
movdqa %xmm4,%xmm5
paddd  %xmm9,%xmm5
movdqa %xmm4,%xmm2
paddd  %xmm10,%xmm2
lea    -0x9(%rsi),%ebp
pshufd $0x50,%xmm3,%xmm6
paddd  %xmm11,%xmm6
paddd  %xmm12,%xmm4
punpcklqdq %xmm2,%xmm3
shufps $0x98,%xmm2,%xmm3
shufps $0x3,%xmm5,%xmm2
shufps $0x98,%xmm5,%xmm2
movd   %ebp,%xmm0
shufps $0xf4,%xmm5,%xmm0
shufps $0x42,%xmm6,%xmm0
pslld  $0x17,%xmm4
paddd  %xmm14,%xmm4
cvttps2dq %xmm4,%xmm4
pshufd $0xf5,%xmm4,%xmm5
pmuludq %xmm7,%xmm4
pshufd $0xe8,%xmm4,%xmm4
pmuludq %xmm7,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm4
pslld  $0x17,%xmm0
paddd  %xmm14,%xmm0
cvttps2dq %xmm0,%xmm0
pshufd $0xf5,%xmm0,%xmm6
pmuludq %xmm7,%xmm0
pshufd $0xe8,%xmm0,%xmm5
pmuludq %xmm7,%xmm6
pshufd $0xe8,%xmm6,%xmm0
punpckldq %xmm0,%xmm5
pslld  $0x17,%xmm2
paddd  %xmm14,%xmm2
cvttps2dq %xmm2,%xmm0
pshufd $0xf5,%xmm0,%xmm6
pmuludq %xmm7,%xmm0
pshufd $0xe8,%xmm0,%xmm2
pmuludq %xmm7,%xmm6
pshufd $0xe8,%xmm6,%xmm0
punpckldq %xmm0,%xmm2
pslld  $0x17,%xmm3
paddd  %xmm14,%xmm3
cvttps2dq %xmm3,%xmm0
pshufd $0xf5,%xmm0,%xmm3
pmuludq %xmm7,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm7,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm0
pand   %xmm1,%xmm0
pand   %xmm1,%xmm2
pand   %xmm1,%xmm5
pand   %xmm1,%xmm4
pcmpeqd %xmm15,%xmm4
pcmpeqd %xmm15,%xmm5
packssdw %xmm4,%xmm5
pcmpeqd %xmm15,%xmm2
pcmpeqd %xmm15,%xmm0
packssdw %xmm2,%xmm0
packsswb %xmm5,%xmm0
paddb  %xmm13,%xmm0
movdqu %xmm0,-0x1(%rbx,%rdx,1)
add    $0x10,%rdx
add    $0xfffffff0,%esi
cmp    %rdx,%rdi
jne    11b0 <int_to_binary+0xa0>
cmp    %rdi,%r8
je     142d <int_to_binary+0x31d>
test   $0x8,%r8b
jne    12ff <int_to_binary+0x1ef>
sub    %rdi,%rcx
jmp    1409 <int_to_binary+0x2f9>
add    $0x8,%r9
and    %r8,%r9
sub    %r9,%rcx
pshufd $0x0,%xmm8,%xmm0
mov    %eax,%edx
sub    %edi,%edx
lea    -0x1(%rdi),%esi
sub    %r9,%rdi
movdqa 0xcee(%rip),%xmm8
movdqa 0xd45(%rip),%xmm9
movdqa 0xd0d(%rip),%xmm3
movdqa 0xd15(%rip),%xmm4
pxor   %xmm5,%xmm5
movdqa 0xd38(%rip),%xmm10
nopl   0x0(%rax,%rax,1)
movd   %edx,%xmm7
pshufd $0x0,%xmm7,%xmm1
paddd  %xmm8,%xmm1
lea    -0x5(%rdx),%ebp
pshufd $0x50,%xmm7,%xmm2
paddd  %xmm9,%xmm2
punpcklqdq %xmm1,%xmm7
shufps $0x98,%xmm1,%xmm7
movd   %ebp,%xmm6
shufps $0xf4,%xmm1,%xmm6
shufps $0x42,%xmm2,%xmm6
pslld  $0x17,%xmm6
paddd  %xmm3,%xmm6
cvttps2dq %xmm6,%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm4,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm4,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
pslld  $0x17,%xmm7
paddd  %xmm3,%xmm7
cvttps2dq %xmm7,%xmm2
pshufd $0xf5,%xmm2,%xmm6
pmuludq %xmm4,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm4,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm2
pand   %xmm0,%xmm2
pand   %xmm0,%xmm1
movslq %esi,%rsi
pcmpeqd %xmm5,%xmm1
pcmpeqd %xmm5,%xmm2
packssdw %xmm1,%xmm2
packsswb %xmm2,%xmm2
paddb  %xmm10,%xmm2
movq   %xmm2,(%rbx,%rsi,1)
add    $0xfffffff8,%edx
add    $0x8,%esi
add    $0x8,%rdi
jne    1350 <int_to_binary+0x240>
cmp    %r9,%r8
je     142d <int_to_binary+0x31d>
mov    %ecx,%edx
not    %edx
add    %eax,%edx
nop
bt     %ecx,%r14d
movslq %edx,%rdx
mov    $0x31,%al
adc    $0xff,%al
mov    %al,(%rbx,%rdx,1)
lea    -0x1(%rcx),%rax
add    $0x1,%edx
test   %rcx,%rcx
mov    %rax,%rcx
jg     1410 <int_to_binary+0x300>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @int_to_binary(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
store i32 %10, i32* %5
br label %11
11: ; preds = %38, %2
%12 = load i32, i32* %5
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %41
14: ; preds = %11
%15 = load i32, i32* %3
%16 = load i32, i32* %5
%17 = ashr i32 %15, %16
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = and i32 %18, 1
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %14
%22 = load i8*, i8** %4
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = sub nsw i32 %23, %24
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %22, i64 %27
store i8 49, i8* %28
br label %37
29: ; preds = %14
%30 = load i8*, i8** %4
%31 = load i32, i32* %6
%32 = load i32, i32* %5
%33 = sub nsw i32 %31, %32
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %30, i64 %35
store i8 48, i8* %36
br label %37
37: ; preds = %29, %21
br label %38
38: ; preds = %37
%39 = load i32, i32* %5
%40 = add nsw i32 %39, -1
store i32 %40, i32* %5
br label %11
41: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @int_to_binary(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %106
5: ; preds = %2
%6 = zext i32 %3 to i64
%7 = add nuw nsw i64 %6, 1
%8 = icmp ult i32 %3, 7
br i1 %8, label %91, label %9
9: ; preds = %5
%10 = icmp ult i32 %3, 15
br i1 %10, label %54, label %11
11: ; preds = %9
%12 = and i64 %7, 8589934576
%13 = insertelement <16 x i32> poison, i32 %0, i64 0
%14 = shufflevector <16 x i32> %13, <16 x i32> poison, <16 x i32> zeroinitializer
br label %15
15: ; preds = %15, %11
%16 = phi i64 [ 0, %11 ], [ %46, %15 ]
%17 = trunc i64 %16 to i32
%18 = sub i32 %3, %17
%19 = insertelement <8 x i32> poison, i32 %18, i64 0
%20 = shufflevector <8 x i32> %19, <8 x i32> poison, <8 x i32> zeroinitializer
%21 = add <8 x i32> %20, <i32 -1, i32 -2, i32 -3, i32 -4, i32 -5, i32 -6, i32 -7, i32 -8>
%22 = add i32 %18, -9
%23 = insertelement <2 x i32> poison, i32 %18, i64 0
%24 = shufflevector <2 x i32> %23, <2 x i32> poison, <2 x i32> zeroinitializer
%25 = add <2 x i32> %24, <i32 -10, i32 -11>
%26 = insertelement <4 x i32> poison, i32 %18, i64 0
%27 = shufflevector <4 x i32> %26, <4 x i32> poison, <4 x i32> zeroinitializer
%28 = add <4 x i32> %27, <i32 -12, i32 -13, i32 -14, i32 -15>
%29 = insertelement <16 x i32> poison, i32 %18, i64 0
%30 = shufflevector <8 x i32> %21, <8 x i32> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%31 = shufflevector <16 x i32> %29, <16 x i32> %30, <16 x i32> <i32 0, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%32 = insertelement <16 x i32> %31, i32 %22, i64 9
%33 = shufflevector <2 x i32> %25, <2 x i32> poison, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%34 = shufflevector <16 x i32> %32, <16 x i32> %33, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 16, i32 17, i32 undef, i32 undef, i32 undef, i32 undef>
%35 = shufflevector <4 x i32> %28, <4 x i32> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%36 = shufflevector <16 x i32> %34, <16 x i32> %35, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 16, i32 17, i32 18, i32 19>
%37 = shl nuw <16 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>, %36
%38 = and <16 x i32> %37, %14
%39 = icmp eq <16 x i32> %38, zeroinitializer
%40 = xor i32 %18, -1
%41 = add i32 %3, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %1, i64 %42
%44 = select <16 x i1> %39, <16 x i8> <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>, <16 x i8> <i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49>
%45 = bitcast i8* %43 to <16 x i8>*
store <16 x i8> %44, <16 x i8>* %45
%46 = add nuw i64 %16, 16
%47 = icmp eq i64 %46, %12
br i1 %47, label %48, label %15
48: ; preds = %15
%49 = icmp eq i64 %7, %12
br i1 %49, label %106, label %50
50: ; preds = %48
%51 = sub nsw i64 %6, %12
%52 = and i64 %7, 8
%53 = icmp eq i64 %52, 0
br i1 %53, label %91, label %54
54: ; preds = %9, %50
%55 = phi i64 [ %12, %50 ], [ 0, %9 ]
%56 = add nuw nsw i64 %6, 1
%57 = and i64 %56, 8589934584
%58 = sub nsw i64 %6, %57
%59 = insertelement <8 x i32> poison, i32 %0, i64 0
%60 = shufflevector <8 x i32> %59, <8 x i32> poison, <8 x i32> zeroinitializer
br label %61
61: ; preds = %61, %54
%62 = phi i64 [ %55, %54 ], [ %87, %61 ]
%63 = trunc i64 %62 to i32
%64 = sub i32 %3, %63
%65 = insertelement <4 x i32> poison, i32 %64, i64 0
%66 = shufflevector <4 x i32> %65, <4 x i32> poison, <4 x i32> zeroinitializer
%67 = add <4 x i32> %66, <i32 -1, i32 -2, i32 -3, i32 -4>
%68 = add i32 %64, -5
%69 = insertelement <2 x i32> poison, i32 %64, i64 0
%70 = shufflevector <2 x i32> %69, <2 x i32> poison, <2 x i32> zeroinitializer
%71 = add <2 x i32> %70, <i32 -6, i32 -7>
%72 = insertelement <8 x i32> poison, i32 %64, i64 0
%73 = shufflevector <4 x i32> %67, <4 x i32> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
%74 = shufflevector <8 x i32> %72, <8 x i32> %73, <8 x i32> <i32 0, i32 8, i32 9, i32 10, i32 11, i32 undef, i32 undef, i32 undef>
%75 = insertelement <8 x i32> %74, i32 %68, i64 5
%76 = shufflevector <2 x i32> %71, <2 x i32> poison, <8 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%77 = shufflevector <8 x i32> %75, <8 x i32> %76, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 8, i32 9>
%78 = shl nuw <8 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>, %77
%79 = and <8 x i32> %78, %60
%80 = icmp eq <8 x i32> %79, zeroinitializer
%81 = xor i32 %64, -1
%82 = add i32 %3, %81
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %1, i64 %83
%85 = select <8 x i1> %80, <8 x i8> <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>, <8 x i8> <i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49>
%86 = bitcast i8* %84 to <8 x i8>*
store <8 x i8> %85, <8 x i8>* %86
%87 = add nuw i64 %62, 8
%88 = icmp eq i64 %87, %57
br i1 %88, label %89, label %61
89: ; preds = %61
%90 = icmp eq i64 %56, %57
br i1 %90, label %106, label %91
91: ; preds = %5, %50, %89
%92 = phi i64 [ %6, %5 ], [ %51, %50 ], [ %58, %89 ]
br label %93
93: ; preds = %91, %93
%94 = phi i64 [ %104, %93 ], [ %92, %91 ]
%95 = trunc i64 %94 to i32
%96 = shl nuw i32 1, %95
%97 = and i32 %96, %0
%98 = icmp eq i32 %97, 0
%99 = xor i32 %95, -1
%100 = add i32 %3, %99
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %1, i64 %101
%103 = select i1 %98, i8 48, i8 49
store i8 %103, i8* %102
%104 = add nsw i64 %94, -1
%105 = icmp sgt i64 %94, 0
br i1 %105, label %93, label %106
106: ; preds = %93, %48, %89, %2
ret void
}