#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 */
long long convertToBinary(long long);
long long convertToDecimal(long long);
long long findNextBinary(long long, long long, int);
int /*<<< orphan*/ inputData(long long *, int *);
int /*<<< orphan*/ printData(long long, long long, int, long long, long long);
int main() {
  long long int decNum = 0;
  long long int nextDec = 0;
  long long int binNum = 0;
  long long int nextBin = 0;
  int digits = 0;
  inputData(&decNum, &digits);
  binNum = convertToBinary(decNum);
  nextBin = findNextBinary(decNum, binNum, digits);
  nextDec = convertToDecimal(nextBin);
  printData(decNum, binNum, digits, nextBin, nextDec);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <inputData@plt>
mov    -0x10(%rbp),%rdi
call   1050 <convertToBinary@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1030 <findNextBinary@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <convertToDecimal@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%r8
call   1060 <printData@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1070 <inputData@plt>
mov    0x10(%rsp),%rdi
call   1050 <convertToBinary@plt>
mov    %rax,%r14
mov    0x10(%rsp),%rdi
mov    0xc(%rsp),%edx
mov    %rax,%rsi
call   1030 <findNextBinary@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <convertToDecimal@plt>
mov    0x10(%rsp),%rdi
mov    0xc(%rsp),%edx
mov    %r14,%rsi
mov    %rbx,%rcx
mov    %rax,%r8
call   1060 <printData@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
store i64 0, i64* %3
store i64 0, i64* %4
store i64 0, i64* %5
store i32 0, i32* %6
%7 = call i32 @inputData(i64* %2, i32* %6)
%8 = load i64, i64* %2
%9 = call i64 @convertToBinary(i64 %8)
store i64 %9, i64* %4
%10 = load i64, i64* %2
%11 = load i64, i64* %4
%12 = load i32, i32* %6
%13 = call i64 @findNextBinary(i64 %10, i64 %11, i32 %12)
store i64 %13, i64* %5
%14 = load i64, i64* %5
%15 = call i64 @convertToDecimal(i64 %14)
store i64 %15, i64* %3
%16 = load i64, i64* %2
%17 = load i64, i64* %4
%18 = load i32, i32* %6
%19 = load i64, i64* %5
%20 = load i64, i64* %3
%21 = call i32 @printData(i64 %16, i64 %17, i32 %18, i64 %19, i64 %20)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @inputData(i64* %1, i32* %2)
%6 = load i64, i64* %1
%7 = call i64 @convertToBinary(i64 %6)
%8 = load i64, i64* %1
%9 = load i32, i32* %2
%10 = call i64 @findNextBinary(i64 %8, i64 %7, i32 %9)
%11 = call i64 @convertToDecimal(i64 %10)
%12 = load i64, i64* %1
%13 = load i32, i32* %2
%14 = call i32 @printData(i64 %12, i64 %7, i32 %13, i64 %10, i64 %11)
ret i32 0
}