#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
void inputData(long long int *dec, int *dig) {
  *dec = 0;
  *dig = 0;
  while (*dec < 1 || *dec > 524287) {
    printf("\nEnter starting integer value: ");
    scanf("%lld", dec);
    if (*dec < 1)
      printf("\nError! Enter a starting value >= 1\n");
    else if (*dec > 524287)
      printf("\nError! Maximum integer for this assignment is 524287\n");
  }
  while (*dig < 1 || *dig > 19) {
    printf("Enter desired number of consecutive 1 digits: ");
    scanf("%d", dig);
    if (*dig < 1)
      printf("\nError! Minimum number of consecutive 1 digits is one!!\n\n");
    else if (*dig > 19)
      printf("\nError! Maximum number of consecutive 1 digits is 19\n\n");
  }
  return;
}


x86 assembly (clang, -O0):
<inputData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpq   $0x1,(%rcx)
mov    %al,-0x11(%rbp)
jl     1169 <inputData+0x49>
mov    -0x8(%rbp),%rax
cmpq   $0x7ffff,(%rax)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1179 <inputData+0x59>
jmp    11dd <inputData+0xbd>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x1,(%rax)
jge    11b6 <inputData+0x96>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <inputData+0xb8>
mov    -0x8(%rbp),%rax
cmpq   $0x7ffff,(%rax)
jle    11d3 <inputData+0xb3>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <inputData+0xb8>
jmp    1145 <inputData+0x25>
jmp    11e2 <inputData+0xc2>
mov    -0x10(%rbp),%rcx
mov    $0x1,%al
cmpl   $0x1,(%rcx)
mov    %al,-0x12(%rbp)
jl     1201 <inputData+0xe1>
mov    -0x10(%rbp),%rax
cmpl   $0x13,(%rax)
setg   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1211 <inputData+0xf1>
jmp    1270 <inputData+0x150>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
jge    124d <inputData+0x12d>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <inputData+0x14b>
mov    -0x10(%rbp),%rax
cmpl   $0x13,(%rax)
jle    1266 <inputData+0x146>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <inputData+0x14b>
jmp    11e2 <inputData+0xc2>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputData>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,(%rdi)
movl   $0x0,(%rsi)
lea    0xeab(%rip),%r15
lea    0xec4(%rip),%r12
lea    0xf99(%rip),%r13
mov    $0xfffffffffff80000,%rbp
jmp    1183 <inputData+0x53>
nopl   0x0(%rax)
call   1030 <puts@plt>
mov    (%rbx),%rax
add    %rbp,%rax
cmp    $0xfffffffffff80001,%rax
jae    11b4 <inputData+0x84>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rbx),%rax
mov    %r13,%rdi
test   %rax,%rax
jle    1170 <inputData+0x40>
lea    0xf1c(%rip),%rdi
cmp    $0x80000,%rax
jae    1170 <inputData+0x40>
jmp    1175 <inputData+0x45>
mov    (%r14),%eax
add    $0xffffffec,%eax
cmp    $0xffffffec,%eax
ja     1219 <inputData+0xe9>
lea    0xe5f(%rip),%r15
lea    0xe87(%rip),%rbx
lea    0xeb9(%rip),%rbp
lea    0xe7c(%rip),%r12
jmp    11f0 <inputData+0xc0>
nopl   (%rax)
call   1030 <puts@plt>
mov    (%r14),%eax
add    $0xffffffec,%eax
cmp    $0xffffffed,%eax
jae    1219 <inputData+0xe9>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%r14),%eax
mov    %rbp,%rdi
test   %eax,%eax
jle    11e0 <inputData+0xb0>
mov    %r12,%rdi
cmp    $0x14,%eax
jae    11e0 <inputData+0xb0>
jmp    11e5 <inputData+0xb5>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"\0AEnter starting integer value: \00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [37 x i8] c"\0AError! Enter a starting value >= 1\0A\00"
@.str.3 = [55 x i8] c"\0AError! Maximum integer for this assignment is 524287\0A\00"
@.str.4 = [47 x i8] c"Enter desired number of consecutive 1 digits: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [58 x i8] c"\0AError! Minimum number of consecutive 1 digits is one!!\0A\0A\00"
@.str.7 = [55 x i8] c"\0AError! Maximum number of consecutive 1 digits is 19\0A\0A\00"
define void @inputData(i64* %0, i32* %1) {
%3 = alloca i64*
%4 = alloca i32*
store i64* %0, i64** %3
store i32* %1, i32** %4
%5 = load i64*, i64** %3
store i64 0, i64* %5
%6 = load i32*, i32** %4
store i32 0, i32* %6
br label %7
7: ; preds = %33, %2
%8 = load i64*, i64** %3
%9 = load i64, i64* %8
%10 = icmp slt i64 %9, 1
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i64*, i64** %3
%13 = load i64, i64* %12
%14 = icmp sgt i64 %13, 524287
br label %15
15: ; preds = %11, %7
%16 = phi i1 [ true, %7 ], [ %14, %11 ]
br i1 %16, label %17, label %34
17: ; preds = %15
%18 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%19 = load i64*, i64** %3
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %19)
%21 = load i64*, i64** %3
%22 = load i64, i64* %21
%23 = icmp slt i64 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %17
%25 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %33
26: ; preds = %17
%27 = load i64*, i64** %3
%28 = load i64, i64* %27
%29 = icmp sgt i64 %28, 524287
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
br label %33
33: ; preds = %32, %24
br label %7
34: ; preds = %15
br label %35
35: ; preds = %61, %34
%36 = load i32*, i32** %4
%37 = load i32, i32* %36
%38 = icmp slt i32 %37, 1
br i1 %38, label %43, label %39
39: ; preds = %35
%40 = load i32*, i32** %4
%41 = load i32, i32* %40
%42 = icmp sgt i32 %41, 19
br label %43
43: ; preds = %39, %35
%44 = phi i1 [ true, %35 ], [ %42, %39 ]
br i1 %44, label %45, label %62
45: ; preds = %43
%46 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
%47 = load i32*, i32** %4
%48 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %47)
%49 = load i32*, i32** %4
%50 = load i32, i32* %49
%51 = icmp slt i32 %50, 1
br i1 %51, label %52, label %54
52: ; preds = %45
%53 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0))
br label %61
54: ; preds = %45
%55 = load i32*, i32** %4
%56 = load i32, i32* %55
%57 = icmp sgt i32 %56, 19
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0))
br label %60
60: ; preds = %58, %54
br label %61
61: ; preds = %60, %52
br label %35
62: ; preds = %43
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"\0AEnter starting integer value: \00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.4 = [47 x i8] c"Enter desired number of consecutive 1 digits: \00"
@.str.5 = [3 x i8] c"%d\00"
@str = [54 x i8] c"\0AError! Maximum number of consecutive 1 digits is 19\0A\00"
@str.8 = [57 x i8] c"\0AError! Minimum number of consecutive 1 digits is one!!\0A\00"
@str.9 = [54 x i8] c"\0AError! Maximum integer for this assignment is 524287\00"
@str.10 = [36 x i8] c"\0AError! Enter a starting value >= 1\00"
define void @inputData(i64* %0, i32* %1) {
store i64 0, i64* %0
store i32 0, i32* %1
br label %7
3: ; preds = %17
%4 = load i32, i32* %1
%5 = add i32 %4, -20
%6 = icmp ult i32 %5, -19
br i1 %6, label %21, label %35
7: ; preds = %2, %17
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %0)
%10 = load i64, i64* %0
%11 = icmp slt i64 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = icmp ugt i64 %10, 524287
br i1 %13, label %14, label %17
14: ; preds = %12, %7
%15 = phi i8* [ getelementptr inbounds ([36 x i8], [36 x i8]* @str.10, i64 0, i64 0), %7 ], [ getelementptr inbounds ([54 x i8], [54 x i8]* @str.9, i64 0, i64 0), %12 ]
%16 = tail call i32 @puts(i8* dereferenceable(1) %15)
br label %17
17: ; preds = %14, %12
%18 = load i64, i64* %0
%19 = add i64 %18, -524288
%20 = icmp ult i64 %19, -524287
br i1 %20, label %7, label %3
21: ; preds = %3, %31
%22 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
%23 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%24 = load i32, i32* %1
%25 = icmp slt i32 %24, 1
br i1 %25, label %28, label %26
26: ; preds = %21
%27 = icmp ugt i32 %24, 19
br i1 %27, label %28, label %31
28: ; preds = %26, %21
%29 = phi i8* [ getelementptr inbounds ([57 x i8], [57 x i8]* @str.8, i64 0, i64 0), %21 ], [ getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0), %26 ]
%30 = tail call i32 @puts(i8* dereferenceable(1) %29)
br label %31
31: ; preds = %28, %26
%32 = load i32, i32* %1
%33 = add i32 %32, -20
%34 = icmp ult i32 %33, -19
br i1 %34, label %21, label %35
35: ; preds = %31, %3
ret void
}