#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*/ Dec2Bin(int, int *);
int /*<<< orphan*/ Dec2Hex(int, char *);
int /*<<< orphan*/ Dec2Oct(int, int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
scalar_t__ xmalloc(int);
int main() {
  int i;
  int target;
  int *targetBin;
  int *targetOct;
  char *targetHex;
  int binDigit;
  int octDigit;
  int hexDigit;
  binDigit = sizeof(int) * 8;
  octDigit = sizeof(int) * 8 / 3;
  hexDigit = sizeof(char) * 8 / 4;
  targetBin = (int *)xmalloc(sizeof(int) * binDigit);
  targetOct = (int *)xmalloc(sizeof(int) * octDigit);
  targetHex = (char *)xmalloc(sizeof(char) * hexDigit);
  scanf("%d", &target);
  Dec2Bin(target, targetBin);
  Dec2Oct(target, targetOct);
  Dec2Hex(target, targetHex);
  for (i = 0; i < binDigit; i++) {
    printf("%d", targetBin[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x20,-0x2c(%rbp)
movl   $0xa,-0x30(%rbp)
movl   $0x2,-0x34(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
movslq -0x30(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <xmalloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x34(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <xmalloc@plt>
mov    %rax,-0x28(%rbp)
lea    0xe3c(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <Dec2Bin@plt>
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <Dec2Oct@plt>
mov    -0xc(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1080 <Dec2Hex@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1229 <main+0xc9>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdea(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f8 <main+0x98>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    $0x80,%edi
call   1060 <xmalloc@plt>
mov    %rax,%r13
mov    $0x28,%edi
call   1060 <xmalloc@plt>
mov    %rax,%r15
mov    $0x2,%edi
call   1060 <xmalloc@plt>
mov    %rax,%r12
lea    0xe65(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
mov    %r13,%rsi
call   1040 <Dec2Bin@plt>
mov    0xc(%rsp),%edi
mov    %r15,%rsi
call   1030 <Dec2Oct@plt>
mov    0xc(%rsp),%edi
mov    %r12,%rsi
call   1080 <Dec2Hex@plt>
xor    %ebx,%ebx
xchg   %ax,%ax
mov    0x0(%r13,%rbx,4),%esi
mov    %r14,%rdi
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    11d0 <main+0x70>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 32, i32* %7
store i32 10, i32* %8
store i32 2, i32* %9
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = mul i64 4, %11
%13 = trunc i64 %12 to i32
%14 = call i64 @xmalloc(i32 %13)
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %4
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = mul i64 4, %17
%19 = trunc i64 %18 to i32
%20 = call i64 @xmalloc(i32 %19)
%21 = inttoptr i64 %20 to i32*
store i32* %21, i32** %5
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = mul i64 1, %23
%25 = trunc i64 %24 to i32
%26 = call i64 @xmalloc(i32 %25)
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %6
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%29 = load i32, i32* %3
%30 = load i32*, i32** %4
%31 = call i32 @Dec2Bin(i32 %29, i32* %30)
%32 = load i32, i32* %3
%33 = load i32*, i32** %5
%34 = call i32 @Dec2Oct(i32 %32, i32* %33)
%35 = load i32, i32* %3
%36 = load i8*, i8** %6
%37 = call i32 @Dec2Hex(i32 %35, i8* %36)
store i32 0, i32* %2
br label %38
38: ; preds = %49, %0
%39 = load i32, i32* %2
%40 = load i32, i32* %7
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %52
42: ; preds = %38
%43 = load i32*, i32** %4
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
%47 = load i32, i32* %46
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %42
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
br label %38
52: ; preds = %38
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i64 @xmalloc(i32 128)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i64 @xmalloc(i32 40)
%6 = inttoptr i64 %5 to i32*
%7 = tail call i64 @xmalloc(i32 2)
%8 = inttoptr i64 %7 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = call i32 @Dec2Bin(i32 %10, i32* %4)
%12 = load i32, i32* %1
%13 = call i32 @Dec2Oct(i32 %12, i32* %6)
%14 = load i32, i32* %1
%15 = call i32 @Dec2Hex(i32 %14, i8* %8)
br label %16
16: ; preds = %0, %16
%17 = phi i64 [ 0, %0 ], [ %21, %16 ]
%18 = getelementptr inbounds i32, i32* %4, i64 %17
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = add nuw nsw i64 %17, 1
%22 = icmp eq i64 %21, 32
br i1 %22, label %23, label %16
23: ; preds = %16
ret i32 0
}