#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 *, char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int number;
  int flag = 1;
  int numA;
  int numB;
  int numC;
  int numD;
  int numE;
  int decimal = 0;
  printf("%s", "Enter a valid binary number (up to 5 digits): ");
  scanf("%d", &number);
  while (flag != -1) {
    decimal = 0;
    if (number >= 0) {
      if (number <= 11111) {
        numA = number / 10000;
        number = number % 10000;
        numB = number / 1000;
        number = number % 1000;
        numC = number / 100;
        number = number % 100;
        numD = number / 10;
        number = number % 10;
        numE = number;
        if (numA == 1) {
          decimal = decimal + (numA * 16);
          flag = -1;
        } else if (numA == 0) {
          decimal = decimal + (numA * 16);
          flag = -1;
        } else {
          puts("You have not entered a binary number");
          printf("%s", "Enter a valid binary number (up to 5 digits): ");
          scanf("%d", &number);
          flag = 1;
        }
        if (numB == 1) {
          decimal = decimal + (numB * 8);
          flag = -1;
        } else if (numB == 0) {
          decimal = decimal + (numB * 8);
          flag = -1;
        } else {
          puts("You have not entered a binary number");
          printf("%s", "Enter a valid binary number (up to 5 digits): ");
          scanf("%d", &number);
          flag = 1;
        }
        if (numC == 1) {
          decimal = decimal + (numC * 4);
          flag = -1;
        } else if (numC == 0) {
          decimal = decimal + (numC * 4);
          flag = -1;
        } else {
          puts("You have not entered a binary number");
          printf("%s", "Enter a valid binary number (up to 5 digits): ");
          scanf("%d", &number);
          flag = 1;
        }
        if (numD == 1) {
          decimal = decimal + (numD * 2);
          flag = -1;
        } else if (numD == 0) {
          decimal = decimal + (numD * 2);
          flag = -1;
        } else {
          puts("You have not entered a binary number");
          printf("%s", "Enter a valid binary number (up to 5 digits): ");
          scanf("%d", &number);
          flag = 1;
        }
        if (numE == 1) {
          decimal = decimal + numE;
          flag = -1;
        } else if (numE == 0) {
          decimal = decimal + numE;
          flag = -1;
        } else {
          puts("You have not entered a binary number");
          printf("%s", "Enter a valid binary number (up to 5 digits): ");
          scanf("%d", &number);
          flag = 1;
        }
      } else {
        puts("You have not entered a binary number");
        printf("%s", "Enter a valid binary number (up to 5 digits): ");
        scanf("%d", &number);
        flag = 1;
      }
    } else {
      puts("You have not entered a binary number");
      printf("%s", "Enter a valid binary number (up to 5 digits): ");
      scanf("%d", &number);
      flag = 1;
    }
  }
  printf("%s%d", "The decimal equivalent is: ", decimal);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xeac(%rip),%rdi
lea    0xea8(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     151e <main+0x3ee>
movl   $0x0,-0x24(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     14e1 <main+0x3b1>
cmpl   $0x2b67,-0x8(%rbp)
jg     14a4 <main+0x374>
mov    -0x8(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    1234 <main+0x104>
mov    -0x24(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x4,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    1295 <main+0x165>
cmpl   $0x0,-0x10(%rbp)
jne    1258 <main+0x128>
mov    -0x24(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x4,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    1290 <main+0x160>
lea    0xdd3(%rip),%rdi
call   1030 <puts@plt>
lea    0xd95(%rip),%rdi
lea    0xd91(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
jmp    1295 <main+0x165>
cmpl   $0x1,-0x14(%rbp)
jne    12b9 <main+0x189>
mov    -0x24(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x3,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    131a <main+0x1ea>
cmpl   $0x0,-0x14(%rbp)
jne    12dd <main+0x1ad>
mov    -0x24(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x3,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    1315 <main+0x1e5>
lea    0xd4e(%rip),%rdi
call   1030 <puts@plt>
lea    0xd10(%rip),%rdi
lea    0xd0c(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd54(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
jmp    131a <main+0x1ea>
cmpl   $0x1,-0x18(%rbp)
jne    133e <main+0x20e>
mov    -0x24(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    139f <main+0x26f>
cmpl   $0x0,-0x18(%rbp)
jne    1362 <main+0x232>
mov    -0x24(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    139a <main+0x26a>
lea    0xcc9(%rip),%rdi
call   1030 <puts@plt>
lea    0xc8b(%rip),%rdi
lea    0xc87(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xccf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
jmp    139f <main+0x26f>
cmpl   $0x1,-0x1c(%rbp)
jne    13c3 <main+0x293>
mov    -0x24(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    1424 <main+0x2f4>
cmpl   $0x0,-0x1c(%rbp)
jne    13e7 <main+0x2b7>
mov    -0x24(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    141f <main+0x2ef>
lea    0xc44(%rip),%rdi
call   1030 <puts@plt>
lea    0xc06(%rip),%rdi
lea    0xc02(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc4a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
jmp    1424 <main+0x2f4>
cmpl   $0x1,-0x20(%rbp)
jne    1443 <main+0x313>
mov    -0x24(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    149f <main+0x36f>
cmpl   $0x0,-0x20(%rbp)
jne    1462 <main+0x332>
mov    -0x24(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0xffffffff,-0xc(%rbp)
jmp    149a <main+0x36a>
lea    0xbc9(%rip),%rdi
call   1030 <puts@plt>
lea    0xb8b(%rip),%rdi
lea    0xb87(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbcf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
jmp    149f <main+0x36f>
jmp    14dc <main+0x3ac>
lea    0xb87(%rip),%rdi
call   1030 <puts@plt>
lea    0xb49(%rip),%rdi
lea    0xb45(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb8d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
jmp    1519 <main+0x3e9>
lea    0xb4a(%rip),%rdi
call   1030 <puts@plt>
lea    0xb0c(%rip),%rdi
lea    0xb08(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb50(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
jmp    1172 <main+0x42>
mov    -0x24(%rbp),%edx
lea    0xb2f(%rip),%rdi
lea    0xb2d(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%r14
lea    0xeba(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xefc(%rip),%r13
mov    %rsp,%rbx
jmp    1189 <main+0x59>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%eax
cmp    $0x2b67,%eax
ja     1170 <main+0x40>
movzwl %ax,%ecx
shr    $0x4,%ecx
imul   $0x347,%ecx,%ecx
shr    $0x13,%ecx
imul   $0x2710,%ecx,%ecx
mov    %eax,%edx
sub    %ecx,%edx
movzwl %dx,%ecx
mov    %ecx,%edx
shr    $0x3,%edx
imul   $0x20c5,%edx,%edx
shr    $0x14,%edx
imul   $0x3e8,%edx,%edx
mov    %ecx,%r13d
sub    %edx,%r13d
movzwl %r13w,%r15d
mov    %r15d,%edx
shr    $0x2,%edx
imul   $0x147b,%edx,%edx
shr    $0x11,%edx
imul   $0x64,%edx,%edx
mov    %r15d,%r12d
sub    %edx,%r12d
imul   $0xcd,%r12d,%edx
shr    $0xa,%edx
and    $0x3e,%edx
lea    (%rdx,%rdx,4),%edx
mov    %r12d,%ebx
sub    %dl,%bl
movzbl %bl,%edx
mov    %edx,(%rsp)
add    $0xffffd8f0,%eax
xor    %ebp,%ebp
cmp    $0x2710,%eax
setb   %bpl
shl    $0x4,%ebp
lea    -0x3e8(%rcx),%eax
cmp    $0x3e7,%eax
ja     1230 <main+0x100>
or     $0x8,%ebp
jmp    1268 <main+0x138>
cmp    $0x3e8,%ecx
jb     1268 <main+0x138>
lea    0xdf3(%rip),%rdi
mov    %edx,%ebx
call   1030 <puts@plt>
mov    %r14,%rdi
lea    0xdb3(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdfb(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    %ebx,%edx
add    $0xffffff9c,%r15d
cmp    $0x63,%r15d
ja     1290 <main+0x160>
add    $0x4,%ebp
lea    0xd87(%rip),%r15
lea    0xdd6(%rip),%r13
mov    %rsp,%rbx
jmp    12d9 <main+0x1a9>
nopl   0x0(%rax,%rax,1)
cmp    $0x64,%r13w
lea    0xd67(%rip),%r15
lea    0xdb6(%rip),%r13
jae    12aa <main+0x17a>
mov    %rsp,%rbx
jmp    12d9 <main+0x1a9>
lea    0xd81(%rip),%rdi
mov    %edx,0x4(%rsp)
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edx
movzwl %r12w,%eax
add    $0xfffffff6,%eax
cmp    $0x9,%eax
ja     12f0 <main+0x1c0>
add    $0x2,%ebp
jmp    1321 <main+0x1f1>
nopw   0x0(%rax,%rax,1)
cmp    $0xa,%r12w
jb     1321 <main+0x1f1>
lea    0xd34(%rip),%rdi
mov    %edx,%r12d
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %r12d,%edx
test   %edx,%edx
je     1331 <main+0x201>
cmp    $0x1,%edx
jne    1170 <main+0x40>
add    $0x1,%ebp
lea    0xd1f(%rip),%rdi
lea    0xd1d(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [47 x i8] c"Enter a valid binary number (up to 5 digits): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [37 x i8] c"You have not entered a binary number\00"
@.str.4 = [5 x i8] c"%s%d\00"
@.str.5 = [28 x i8] c"The decimal equivalent is: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
store i32 0, i32* %9
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %12
12: ; preds = %151, %0
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %152
15: ; preds = %12
store i32 0, i32* %9
%16 = load i32, i32* %2
%17 = icmp sge i32 %16, 0
br i1 %17, label %18, label %147
18: ; preds = %15
%19 = load i32, i32* %2
%20 = icmp sle i32 %19, 11111
br i1 %20, label %21, label %142
21: ; preds = %18
%22 = load i32, i32* %2
%23 = sdiv i32 %22, 10000
store i32 %23, i32* %4
%24 = load i32, i32* %2
%25 = srem i32 %24, 10000
store i32 %25, i32* %2
%26 = load i32, i32* %2
%27 = sdiv i32 %26, 1000
store i32 %27, i32* %5
%28 = load i32, i32* %2
%29 = srem i32 %28, 1000
store i32 %29, i32* %2
%30 = load i32, i32* %2
%31 = sdiv i32 %30, 100
store i32 %31, i32* %6
%32 = load i32, i32* %2
%33 = srem i32 %32, 100
store i32 %33, i32* %2
%34 = load i32, i32* %2
%35 = sdiv i32 %34, 10
store i32 %35, i32* %7
%36 = load i32, i32* %2
%37 = srem i32 %36, 10
store i32 %37, i32* %2
%38 = load i32, i32* %2
store i32 %38, i32* %8
%39 = load i32, i32* %4
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %46
41: ; preds = %21
%42 = load i32, i32* %9
%43 = load i32, i32* %4
%44 = mul nsw i32 %43, 16
%45 = add nsw i32 %42, %44
store i32 %45, i32* %9
store i32 -1, i32* %3
br label %59
46: ; preds = %21
%47 = load i32, i32* %4
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load i32, i32* %9
%51 = load i32, i32* %4
%52 = mul nsw i32 %51, 16
%53 = add nsw i32 %50, %52
store i32 %53, i32* %9
store i32 -1, i32* %3
br label %58
54: ; preds = %46
%55 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%56 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%57 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %58
58: ; preds = %54, %49
br label %59
59: ; preds = %58, %41
%60 = load i32, i32* %5
%61 = icmp eq i32 %60, 1
br i1 %61, label %62, label %67
62: ; preds = %59
%63 = load i32, i32* %9
%64 = load i32, i32* %5
%65 = mul nsw i32 %64, 8
%66 = add nsw i32 %63, %65
store i32 %66, i32* %9
store i32 -1, i32* %3
br label %80
67: ; preds = %59
%68 = load i32, i32* %5
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %75
70: ; preds = %67
%71 = load i32, i32* %9
%72 = load i32, i32* %5
%73 = mul nsw i32 %72, 8
%74 = add nsw i32 %71, %73
store i32 %74, i32* %9
store i32 -1, i32* %3
br label %79
75: ; preds = %67
%76 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%77 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%78 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %79
79: ; preds = %75, %70
br label %80
80: ; preds = %79, %62
%81 = load i32, i32* %6
%82 = icmp eq i32 %81, 1
br i1 %82, label %83, label %88
83: ; preds = %80
%84 = load i32, i32* %9
%85 = load i32, i32* %6
%86 = mul nsw i32 %85, 4
%87 = add nsw i32 %84, %86
store i32 %87, i32* %9
store i32 -1, i32* %3
br label %101
88: ; preds = %80
%89 = load i32, i32* %6
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %96
91: ; preds = %88
%92 = load i32, i32* %9
%93 = load i32, i32* %6
%94 = mul nsw i32 %93, 4
%95 = add nsw i32 %92, %94
store i32 %95, i32* %9
store i32 -1, i32* %3
br label %100
96: ; preds = %88
%97 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%98 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%99 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %100
100: ; preds = %96, %91
br label %101
101: ; preds = %100, %83
%102 = load i32, i32* %7
%103 = icmp eq i32 %102, 1
br i1 %103, label %104, label %109
104: ; preds = %101
%105 = load i32, i32* %9
%106 = load i32, i32* %7
%107 = mul nsw i32 %106, 2
%108 = add nsw i32 %105, %107
store i32 %108, i32* %9
store i32 -1, i32* %3
br label %122
109: ; preds = %101
%110 = load i32, i32* %7
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %117
112: ; preds = %109
%113 = load i32, i32* %9
%114 = load i32, i32* %7
%115 = mul nsw i32 %114, 2
%116 = add nsw i32 %113, %115
store i32 %116, i32* %9
store i32 -1, i32* %3
br label %121
117: ; preds = %109
%118 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%119 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%120 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %121
121: ; preds = %117, %112
br label %122
122: ; preds = %121, %104
%123 = load i32, i32* %8
%124 = icmp eq i32 %123, 1
br i1 %124, label %125, label %129
125: ; preds = %122
%126 = load i32, i32* %9
%127 = load i32, i32* %8
%128 = add nsw i32 %126, %127
store i32 %128, i32* %9
store i32 -1, i32* %3
br label %141
129: ; preds = %122
%130 = load i32, i32* %8
%131 = icmp eq i32 %130, 0
br i1 %131, label %132, label %136
132: ; preds = %129
%133 = load i32, i32* %9
%134 = load i32, i32* %8
%135 = add nsw i32 %133, %134
store i32 %135, i32* %9
store i32 -1, i32* %3
br label %140
136: ; preds = %129
%137 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%138 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%139 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %140
140: ; preds = %136, %132
br label %141
141: ; preds = %140, %125
br label %146
142: ; preds = %18
%143 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%144 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%145 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %146
146: ; preds = %142, %141
br label %151
147: ; preds = %15
%148 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%149 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%150 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %151
151: ; preds = %147, %146
br label %12
152: ; preds = %12
%153 = load i32, i32* %9
%154 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %153)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [47 x i8] c"Enter a valid binary number (up to 5 digits): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [37 x i8] c"You have not entered a binary number\00"
@.str.4 = [5 x i8] c"%s%d\00"
@.str.5 = [28 x i8] c"The decimal equivalent is: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %60, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp ult i32 %6, 11112
br i1 %7, label %8, label %60
8: ; preds = %4
%9 = trunc i32 %6 to i16
%10 = urem i16 %9, 10000
%11 = zext i16 %10 to i32
%12 = urem i16 %10, 1000
%13 = zext i16 %12 to i32
%14 = urem i16 %12, 100
%15 = zext i16 %14 to i32
%16 = trunc i16 %14 to i8
%17 = urem i8 %16, 10
%18 = zext i8 %17 to i32
store i32 %18, i32* %1
%19 = add nsw i32 %6, -10000
%20 = icmp ult i32 %19, 10000
%21 = select i1 %20, i32 16, i32 0
%22 = add nsw i32 %11, -1000
%23 = icmp ult i32 %22, 1000
br i1 %23, label %24, label %26
24: ; preds = %8
%25 = or i32 %21, 8
br label %32
26: ; preds = %8
%27 = icmp ult i16 %10, 1000
br i1 %27, label %32, label %28
28: ; preds = %26
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
br label %32
32: ; preds = %26, %28, %24
%33 = phi i32 [ %25, %24 ], [ %21, %28 ], [ %21, %26 ]
%34 = add nsw i32 %13, -100
%35 = icmp ult i32 %34, 100
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = add nsw i32 %33, 4
br label %44
38: ; preds = %32
%39 = icmp ult i16 %12, 100
br i1 %39, label %44, label %40
40: ; preds = %38
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%42 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
br label %44
44: ; preds = %38, %40, %36
%45 = phi i32 [ %37, %36 ], [ %33, %40 ], [ %33, %38 ]
%46 = add nsw i32 %15, -10
%47 = icmp ult i32 %46, 10
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = add nsw i32 %45, 2
br label %56
50: ; preds = %44
%51 = icmp ult i16 %14, 10
br i1 %51, label %56, label %52
52: ; preds = %50
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%54 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
br label %56
56: ; preds = %50, %52, %48
%57 = phi i32 [ %49, %48 ], [ %45, %52 ], [ %45, %50 ]
switch i32 %18, label %60 [
i32 1, label %58
i32 0, label %63
]
58: ; preds = %56
%59 = add nsw i32 %57, 1
br label %63
60: ; preds = %4, %56
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%62 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
br label %4
63: ; preds = %56, %58
%64 = phi i32 [ %59, %58 ], [ %57, %56 ]
%65 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %64)
ret i32 0
}