#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 */
char *dec2bin(int);
scalar_t__ malloc(int);
char *int2bin(int a) {
  int result = 0;
  int a1, a2, a3 = 0;
  a1 = a % 256;
  a2 = a % 255;
  a3 = a % 253;
  char *a1c;
  char *a2c;
  char *a3c;
  a1c = (char *)malloc(sizeof(char) * 8);
  a2c = (char *)malloc(sizeof(char) * 8);
  a3c = (char *)malloc(sizeof(char) * 8);
  a1c = dec2bin(a1);
  a2c = dec2bin(a2);
  a3c = dec2bin(a3);
  char *atc;
  atc = (char *)malloc(sizeof(char) * 35);
  int i;
  for (i = 0; i < 8; i++) {
    atc[i] = a1c[i];
  }
  for (i = 0; i < 8; i++) {
    atc[i + 8] = a2c[i];
  }
  for (i = 0; i < 8; i++) {
    atc[i + 16] = a3c[i];
  }
  return atc;
}


x86 assembly (clang, -O0):
<int2bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xff,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xfd,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <dec2bin@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <dec2bin@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <dec2bin@plt>
mov    %rax,-0x30(%rbp)
mov    $0x23,%edi
call   1030 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x8,-0x3c(%rbp)
jge    11f4 <int2bin+0xd4>
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11c6 <int2bin+0xa6>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x8,-0x3c(%rbp)
jge    122e <int2bin+0x10e>
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x38(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x8,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11fb <int2bin+0xdb>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x8,-0x3c(%rbp)
jge    1268 <int2bin+0x148>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x38(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x10,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1235 <int2bin+0x115>
mov    -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int2bin>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edi,%r14d
lea    0xff(%r14),%eax
test   %edi,%edi
cmovns %edi,%eax
and    $0xffffff00,%eax
movslq %edi,%r15
sub    %eax,%r14d
imul   $0xffffffff80808081,%r15,%rbx
shr    $0x20,%rbx
add    %r15d,%ebx
mov    %ebx,%eax
shr    $0x1f,%eax
sar    $0x7,%ebx
add    %eax,%ebx
mov    %ebx,%eax
shl    $0x8,%eax
sub    %eax,%ebx
add    %r15d,%ebx
imul   $0xffffffff81848da9,%r15,%rax
shr    $0x20,%rax
add    %r15d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x7,%eax
add    %ecx,%eax
imul   $0xfd,%eax,%eax
sub    %eax,%r15d
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %r14d,%edi
call   1040 <dec2bin@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   1040 <dec2bin@plt>
mov    %rax,%rbx
mov    %r15d,%edi
call   1040 <dec2bin@plt>
mov    %rax,%r14
mov    $0x23,%edi
call   1030 <malloc@plt>
mov    (%r12),%cl
mov    %cl,(%rax)
mov    0x1(%r12),%cl
mov    %cl,0x1(%rax)
mov    0x2(%r12),%cl
mov    %cl,0x2(%rax)
mov    0x3(%r12),%cl
mov    %cl,0x3(%rax)
mov    0x4(%r12),%cl
mov    %cl,0x4(%rax)
mov    0x5(%r12),%cl
mov    %cl,0x5(%rax)
mov    0x6(%r12),%cl
mov    %cl,0x6(%rax)
mov    0x7(%r12),%cl
mov    %cl,0x7(%rax)
mov    (%rbx),%cl
mov    %cl,0x8(%rax)
mov    0x1(%rbx),%cl
mov    %cl,0x9(%rax)
mov    0x2(%rbx),%cl
mov    %cl,0xa(%rax)
mov    0x3(%rbx),%cl
mov    %cl,0xb(%rax)
mov    0x4(%rbx),%cl
mov    %cl,0xc(%rax)
mov    0x5(%rbx),%cl
mov    %cl,0xd(%rax)
mov    0x6(%rbx),%cl
mov    %cl,0xe(%rax)
mov    0x7(%rbx),%cl
mov    %cl,0xf(%rax)
mov    (%r14),%cl
mov    %cl,0x10(%rax)
mov    0x1(%r14),%cl
mov    %cl,0x11(%rax)
mov    0x2(%r14),%cl
mov    %cl,0x12(%rax)
mov    0x3(%r14),%cl
mov    %cl,0x13(%rax)
mov    0x4(%r14),%cl
mov    %cl,0x14(%rax)
mov    0x5(%r14),%cl
mov    %cl,0x15(%rax)
mov    0x6(%r14),%cl
mov    %cl,0x16(%rax)
mov    0x7(%r14),%cl
mov    %cl,0x17(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @int2bin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %6
%12 = load i32, i32* %2
%13 = srem i32 %12, 256
store i32 %13, i32* %4
%14 = load i32, i32* %2
%15 = srem i32 %14, 255
store i32 %15, i32* %5
%16 = load i32, i32* %2
%17 = srem i32 %16, 253
store i32 %17, i32* %6
%18 = call i64 @malloc(i32 8)
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %7
%20 = call i64 @malloc(i32 8)
%21 = inttoptr i64 %20 to i8*
store i8* %21, i8** %8
%22 = call i64 @malloc(i32 8)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %9
%24 = load i32, i32* %4
%25 = call i8* @dec2bin(i32 %24)
store i8* %25, i8** %7
%26 = load i32, i32* %5
%27 = call i8* @dec2bin(i32 %26)
store i8* %27, i8** %8
%28 = load i32, i32* %6
%29 = call i8* @dec2bin(i32 %28)
store i8* %29, i8** %9
%30 = call i64 @malloc(i32 35)
%31 = inttoptr i64 %30 to i8*
store i8* %31, i8** %10
store i32 0, i32* %11
br label %32
32: ; preds = %45, %1
%33 = load i32, i32* %11
%34 = icmp slt i32 %33, 8
br i1 %34, label %35, label %48
35: ; preds = %32
%36 = load i8*, i8** %7
%37 = load i32, i32* %11
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = load i8*, i8** %10
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
store i8 %40, i8* %44
br label %45
45: ; preds = %35
%46 = load i32, i32* %11
%47 = add nsw i32 %46, 1
store i32 %47, i32* %11
br label %32
48: ; preds = %32
store i32 0, i32* %11
br label %49
49: ; preds = %63, %48
%50 = load i32, i32* %11
%51 = icmp slt i32 %50, 8
br i1 %51, label %52, label %66
52: ; preds = %49
%53 = load i8*, i8** %8
%54 = load i32, i32* %11
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
%57 = load i8, i8* %56
%58 = load i8*, i8** %10
%59 = load i32, i32* %11
%60 = add nsw i32 %59, 8
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %58, i64 %61
store i8 %57, i8* %62
br label %63
63: ; preds = %52
%64 = load i32, i32* %11
%65 = add nsw i32 %64, 1
store i32 %65, i32* %11
br label %49
66: ; preds = %49
store i32 0, i32* %11
br label %67
67: ; preds = %81, %66
%68 = load i32, i32* %11
%69 = icmp slt i32 %68, 8
br i1 %69, label %70, label %84
70: ; preds = %67
%71 = load i8*, i8** %9
%72 = load i32, i32* %11
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %71, i64 %73
%75 = load i8, i8* %74
%76 = load i8*, i8** %10
%77 = load i32, i32* %11
%78 = add nsw i32 %77, 16
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %76, i64 %79
store i8 %75, i8* %80
br label %81
81: ; preds = %70
%82 = load i32, i32* %11
%83 = add nsw i32 %82, 1
store i32 %83, i32* %11
br label %67
84: ; preds = %67
%85 = load i8*, i8** %10
ret i8* %85
}

LLVM IR (-O2):
define i8* @int2bin(i32 %0) {
%2 = srem i32 %0, 256
%3 = srem i32 %0, 255
%4 = srem i32 %0, 253
%5 = tail call i64 @malloc(i32 8)
%6 = tail call i64 @malloc(i32 8)
%7 = tail call i64 @malloc(i32 8)
%8 = tail call i8* @dec2bin(i32 %2)
%9 = tail call i8* @dec2bin(i32 %3)
%10 = tail call i8* @dec2bin(i32 %4)
%11 = tail call i64 @malloc(i32 35)
%12 = inttoptr i64 %11 to i8*
%13 = load i8, i8* %8
store i8 %13, i8* %12
%14 = getelementptr inbounds i8, i8* %8, i64 1
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %12, i64 1
store i8 %15, i8* %16
%17 = getelementptr inbounds i8, i8* %8, i64 2
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %12, i64 2
store i8 %18, i8* %19
%20 = getelementptr inbounds i8, i8* %8, i64 3
%21 = load i8, i8* %20
%22 = getelementptr inbounds i8, i8* %12, i64 3
store i8 %21, i8* %22
%23 = getelementptr inbounds i8, i8* %8, i64 4
%24 = load i8, i8* %23
%25 = getelementptr inbounds i8, i8* %12, i64 4
store i8 %24, i8* %25
%26 = getelementptr inbounds i8, i8* %8, i64 5
%27 = load i8, i8* %26
%28 = getelementptr inbounds i8, i8* %12, i64 5
store i8 %27, i8* %28
%29 = getelementptr inbounds i8, i8* %8, i64 6
%30 = load i8, i8* %29
%31 = getelementptr inbounds i8, i8* %12, i64 6
store i8 %30, i8* %31
%32 = getelementptr inbounds i8, i8* %8, i64 7
%33 = load i8, i8* %32
%34 = getelementptr inbounds i8, i8* %12, i64 7
store i8 %33, i8* %34
%35 = load i8, i8* %9
%36 = getelementptr inbounds i8, i8* %12, i64 8
store i8 %35, i8* %36
%37 = getelementptr inbounds i8, i8* %9, i64 1
%38 = load i8, i8* %37
%39 = getelementptr inbounds i8, i8* %12, i64 9
store i8 %38, i8* %39
%40 = getelementptr inbounds i8, i8* %9, i64 2
%41 = load i8, i8* %40
%42 = getelementptr inbounds i8, i8* %12, i64 10
store i8 %41, i8* %42
%43 = getelementptr inbounds i8, i8* %9, i64 3
%44 = load i8, i8* %43
%45 = getelementptr inbounds i8, i8* %12, i64 11
store i8 %44, i8* %45
%46 = getelementptr inbounds i8, i8* %9, i64 4
%47 = load i8, i8* %46
%48 = getelementptr inbounds i8, i8* %12, i64 12
store i8 %47, i8* %48
%49 = getelementptr inbounds i8, i8* %9, i64 5
%50 = load i8, i8* %49
%51 = getelementptr inbounds i8, i8* %12, i64 13
store i8 %50, i8* %51
%52 = getelementptr inbounds i8, i8* %9, i64 6
%53 = load i8, i8* %52
%54 = getelementptr inbounds i8, i8* %12, i64 14
store i8 %53, i8* %54
%55 = getelementptr inbounds i8, i8* %9, i64 7
%56 = load i8, i8* %55
%57 = getelementptr inbounds i8, i8* %12, i64 15
store i8 %56, i8* %57
%58 = load i8, i8* %10
%59 = getelementptr inbounds i8, i8* %12, i64 16
store i8 %58, i8* %59
%60 = getelementptr inbounds i8, i8* %10, i64 1
%61 = load i8, i8* %60
%62 = getelementptr inbounds i8, i8* %12, i64 17
store i8 %61, i8* %62
%63 = getelementptr inbounds i8, i8* %10, i64 2
%64 = load i8, i8* %63
%65 = getelementptr inbounds i8, i8* %12, i64 18
store i8 %64, i8* %65
%66 = getelementptr inbounds i8, i8* %10, i64 3
%67 = load i8, i8* %66
%68 = getelementptr inbounds i8, i8* %12, i64 19
store i8 %67, i8* %68
%69 = getelementptr inbounds i8, i8* %10, i64 4
%70 = load i8, i8* %69
%71 = getelementptr inbounds i8, i8* %12, i64 20
store i8 %70, i8* %71
%72 = getelementptr inbounds i8, i8* %10, i64 5
%73 = load i8, i8* %72
%74 = getelementptr inbounds i8, i8* %12, i64 21
store i8 %73, i8* %74
%75 = getelementptr inbounds i8, i8* %10, i64 6
%76 = load i8, i8* %75
%77 = getelementptr inbounds i8, i8* %12, i64 22
store i8 %76, i8* %77
%78 = getelementptr inbounds i8, i8* %10, i64 7
%79 = load i8, i8* %78
%80 = getelementptr inbounds i8, i8* %12, i64 23
store i8 %79, i8* %80
ret i8* %12
}