#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 EOF;
int getchar();
scalar_t__ is_num(int);
scalar_t__ is_ws(int);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ showbits(unsigned int);
int main(void) {
  int c, in_num = 0;
  unsigned total = 0;
  while ((c = getchar()) != EOF) {
    if (in_num && is_ws(c)) {
      printf("%u = ", total);
      showbits(total);
      in_num = 0;
      total = 0;
    } else if (!in_num && is_num(c)) {
      total = c - '0';
      in_num = 1;
    } else if (in_num && is_num(c)) {
      total = total * 10 + c - '0';
    } else {
      in_num = 0;
      total = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%eax
je     1248 <main+0xf8>
cmpl   $0x0,-0xc(%rbp)
je     11cc <main+0x7c>
mov    -0x8(%rbp),%edi
call   1040 <is_ws@plt>
cmp    $0x0,%rax
je     11cc <main+0x7c>
mov    -0x10(%rbp),%esi
lea    0xe54(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%edi
call   1030 <showbits@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    1243 <main+0xf3>
cmpl   $0x0,-0xc(%rbp)
jne    11fd <main+0xad>
mov    -0x8(%rbp),%edi
call   1070 <is_num@plt>
cmp    $0x0,%rax
je     11fd <main+0xad>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
jmp    123e <main+0xee>
cmpl   $0x0,-0xc(%rbp)
je     122b <main+0xdb>
mov    -0x8(%rbp),%edi
call   1070 <is_num@plt>
cmp    $0x0,%rax
je     122b <main+0xdb>
imul   $0xa,-0x10(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x10(%rbp)
jmp    1239 <main+0xe9>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    123e <main+0xee>
jmp    1243 <main+0xf3>
jmp    116d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e82(%rip),%r12
cmp    (%r12),%eax
jne    1177 <main+0x27>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
lea    0xe80(%rip),%r14
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    11a2 <main+0x52>
nopw   0x0(%rax,%rax,1)
mov    %al,%bpl
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebx
cmp    (%r12),%eax
je     116c <main+0x1c>
mov    %ebx,%edi
test   %ebp,%ebp
je     11d0 <main+0x80>
call   1040 <is_ws@plt>
test   %rax,%rax
je     11f0 <main+0xa0>
mov    %r14,%rdi
mov    %r15d,%esi
call   1050 <printf@plt>
mov    %r15d,%edi
call   1030 <showbits@plt>
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    1193 <main+0x43>
nopl   0x0(%rax)
call   1070 <is_num@plt>
xor    %r15d,%r15d
xor    %ebp,%ebp
test   %rax,%rax
setne  %al
je     1190 <main+0x40>
add    $0xffffffd0,%ebx
mov    %ebx,%r15d
jmp    1190 <main+0x40>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1070 <is_num@plt>
test   %rax,%rax
je     11c5 <main+0x75>
lea    (%r15,%r15,4),%eax
lea    (%rbx,%rax,2),%r15d
add    $0xffffffd0,%r15d
mov    $0x1,%ebp
jmp    1193 <main+0x43>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [6 x i8] c"%u = \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %47, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %48
9: ; preds = %5
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32, i32* %2
%14 = call i64 @is_ws(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i32, i32* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %4
%20 = call i32 @showbits(i32 %19)
store i32 0, i32* %3
store i32 0, i32* %4
br label %47
21: ; preds = %12, %9
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, 0
br i1 %23, label %31, label %24
24: ; preds = %21
%25 = load i32, i32* %2
%26 = call i64 @is_num(i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %2
%30 = sub nsw i32 %29, 48
store i32 %30, i32* %4
store i32 1, i32* %3
br label %46
31: ; preds = %24, %21
%32 = load i32, i32* %3
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %44
34: ; preds = %31
%35 = load i32, i32* %2
%36 = call i64 @is_num(i32 %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %34
%39 = load i32, i32* %4
%40 = mul i32 %39, 10
%41 = load i32, i32* %2
%42 = add i32 %40, %41
%43 = sub i32 %42, 48
store i32 %43, i32* %4
br label %45
44: ; preds = %34, %31
store i32 0, i32* %3
store i32 0, i32* %4
br label %45
45: ; preds = %44, %38
br label %46
46: ; preds = %45, %28
br label %47
47: ; preds = %46, %16
br label %5
48: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [6 x i8] c"%u = \00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %35, label %4
4: ; preds = %0, %29
%5 = phi i32 [ %32, %29 ], [ %1, %0 ]
%6 = phi i32 [ %31, %29 ], [ 0, %0 ]
%7 = phi i32 [ %30, %29 ], [ 0, %0 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = tail call i64 @is_ws(i32 %5)
%11 = icmp eq i64 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %9
%13 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
%14 = tail call i32 @showbits(i32 %6)
br label %29
15: ; preds = %4
%16 = tail call i64 @is_num(i32 %5)
%17 = icmp eq i64 %16, 0
%18 = add nsw i32 %5, -48
%19 = xor i1 %17, true
%20 = zext i1 %19 to i32
%21 = select i1 %17, i32 0, i32 %18
br label %29
22: ; preds = %9
%23 = tail call i64 @is_num(i32 %5)
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %22
%26 = mul i32 %6, 10
%27 = add i32 %5, -48
%28 = add i32 %27, %26
br label %29
29: ; preds = %15, %22, %25, %12
%30 = phi i32 [ 0, %12 ], [ 1, %25 ], [ 0, %22 ], [ %20, %15 ]
%31 = phi i32 [ 0, %12 ], [ %28, %25 ], [ 0, %22 ], [ %21, %15 ]
%32 = tail call i32 (...) @getchar()
%33 = load i32, i32* @EOF
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %4
35: ; preds = %29, %0
ret i32 0
}