#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 */
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
scalar_t__ evenbits_compl(char *, int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(int argc, char **argv) {
  char buff[256];
  int n, i;
  while (1) {
    printf("input > ");
    if (fgets(buff, sizeof(buff), stdin) == NULL)
      continue;
    buff[strlen(buff) - 1] = '\0';
    for (n = 0; n < 2; n++) {
      if (evenbits_compl(buff, strlen(buff)) == 0)
        printf("output> %s [", buff);
      for (i = 0; i < strlen(buff); i++)
        printf("%03d ", buff[i]);
      printf("\b]\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    1190 <main+0x50>
jmp    1159 <main+0x19>
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x110(%rbp,%rax,1)
movl   $0x0,-0x114(%rbp)
cmpl   $0x2,-0x114(%rbp)
jge    128c <main+0x14c>
lea    -0x110(%rbp),%rax
mov    %rax,-0x120(%rbp)
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x120(%rbp),%rdi
mov    %eax,%esi
call   1060 <evenbits_compl@plt>
cmp    $0x0,%rax
jne    1207 <main+0xc7>
lea    -0x110(%rbp),%rsi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x118(%rbp)
mov    -0x118(%rbp),%eax
mov    %eax,-0x124(%rbp)
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x124(%rbp),%eax
cmp    %ecx,%eax
jge    126a <main+0x12a>
movslq -0x118(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%esi
ff
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
jmp    1211 <main+0xd1>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    11b3 <main+0x73>
jmp    1159 <main+0x19>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    0x2e80(%rip),%r14
mov    %rsp,%rbx
lea    0xea4(%rip),%r12
lea    0xea3(%rip),%r13
jmp    1188 <main+0x38>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <puts@plt>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     1188 <main+0x38>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <evenbits_compl@plt>
test   %rax,%rax
jne    11e2 <main+0x92>
lea    0xe31(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1222 <main+0xd2>
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%rsp,%r15,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%r15
jl     1200 <main+0xb0>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <evenbits_compl@plt>
test   %rax,%rax
jne    1252 <main+0x102>
lea    0xdc1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1180 <main+0x30>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rsp,%rbp,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1270 <main+0x120>
jmp    1180 <main+0x30>

LLVM IR (-O0):
@.str = [9 x i8] c"input > \00"
@stdin = global i32 0
@.str.1 = [13 x i8] c"output> %s [\00"
@.str.2 = [6 x i8] c"%03d \00"
@.str.3 = [4 x i8] c"\08]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %9
9: ; preds = %2, %15, %55
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32* @fgets(i8* %11, i32 256, i32 %12)
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %16
15: ; preds = %9
br label %9
16: ; preds = %9
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %20
store i8 0, i8* %21
store i32 0, i32* %7
br label %22
22: ; preds = %52, %16
%23 = load i32, i32* %7
%24 = icmp slt i32 %23, 2
br i1 %24, label %25, label %55
25: ; preds = %22
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = call i64 @evenbits_compl(i8* %26, i32 %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %31, %25
store i32 0, i32* %8
br label %35
35: ; preds = %47, %34
%36 = load i32, i32* %8
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%38 = call i32 @strlen(i8* %37)
%39 = icmp slt i32 %36, %38
br i1 %39, label %40, label %50
40: ; preds = %35
%41 = load i32, i32* %8
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %40
%48 = load i32, i32* %8
%49 = add nsw i32 %48, 1
store i32 %49, i32* %8
br label %35
50: ; preds = %35
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %52
52: ; preds = %50
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %22
55: ; preds = %22
br label %9
}

LLVM IR (-O2):
@.str = [9 x i8] c"input > \00"
@stdin = global i32 0
@.str.1 = [13 x i8] c"output> %s [\00"
@.str.2 = [6 x i8] c"%03d \00"
@str = [3 x i8] c"\08]\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %55, %2
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %4, i32 256, i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %55, label %10
10: ; preds = %5
%11 = call i32 @strlen(i8* %4)
%12 = add nsw i32 %11, -1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %13
store i8 0, i8* %14
%15 = call i32 @strlen(i8* %4)
%16 = call i64 @evenbits_compl(i8* %4, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %10
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %20
20: ; preds = %18, %10
%21 = call i32 @strlen(i8* %4)
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %33
23: ; preds = %20, %23
%24 = phi i64 [ %29, %23 ], [ 0, %20 ]
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = add nuw nsw i64 %24, 1
%30 = call i32 @strlen(i8* %4)
%31 = sext i32 %30 to i64
%32 = icmp slt i64 %29, %31
br i1 %32, label %23, label %33
33: ; preds = %23, %20
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%35 = call i32 @strlen(i8* %4)
%36 = call i64 @evenbits_compl(i8* %4, i32 %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %40
40: ; preds = %38, %33
%41 = call i32 @strlen(i8* %4)
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %53
43: ; preds = %40, %43
%44 = phi i64 [ %49, %43 ], [ 0, %40 ]
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = add nuw nsw i64 %44, 1
%50 = call i32 @strlen(i8* %4)
%51 = sext i32 %50 to i64
%52 = icmp slt i64 %49, %51
br i1 %52, label %43, label %53
53: ; preds = %43, %40
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %55
55: ; preds = %53, %5
br label %5
}