#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 /*<<< orphan*/ char_to_digit(int *);
int encrypt(int /*<<< orphan*/);
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int h_many = 0;
  int buffer[4];
  buffer[h_many] = (int)getchar();
  while (buffer[h_many] != EOF) {
    ++h_many;
    if (h_many == 4) {
      printf(" %11i\n", encrypt(char_to_digit(buffer)));
      h_many = 0;
    }
    buffer[h_many] = (int)getchar();
  }
  if (h_many > 0) {
    for (int i = h_many; i < 4; ++i)
      buffer[i] = ' ';
    printf(" %10i\n", encrypt(char_to_digit(buffer)));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%eax
je     11cc <main+0x8c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    11b6 <main+0x76>
lea    -0x20(%rbp),%rdi
call   1030 <char_to_digit@plt>
mov    %eax,%edi
call   1050 <encrypt@plt>
mov    %eax,%esi
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
jmp    1167 <main+0x27>
cmpl   $0x0,-0x8(%rbp)
jle    121e <main+0xde>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    1200 <main+0xc0>
movslq -0x24(%rbp),%rax
movl   $0x20,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11dc <main+0x9c>
lea    -0x20(%rbp),%rdi
call   1030 <char_to_digit@plt>
mov    %eax,%edi
call   1050 <encrypt@plt>
mov    %eax,%esi
lea    0xdee(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,(%rsp)
mov    0x2e8d(%rip),%rbx
cmp    %eax,(%rbx)
je     11fc <main+0xbc>
mov    %rsp,%r14
lea    0xe93(%rip),%r15
xor    %ebp,%ebp
jmp    1191 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
movslq %ebp,%rcx
mov    %eax,(%rsp,%rcx,4)
cmp    %eax,(%rbx)
je     11b6 <main+0x76>
add    $0x1,%ebp
cmp    $0x4,%ebp
jne    1180 <main+0x40>
mov    %r14,%rdi
call   1030 <char_to_digit@plt>
mov    %eax,%edi
call   1050 <encrypt@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %ebp,%ebp
jmp    1180 <main+0x40>
test   %ebp,%ebp
jle    11fc <main+0xbc>
cmp    $0x3,%ebp
ja     11df <main+0x9f>
mov    %ebp,%eax
movl   $0x20,(%rsp,%rax,4)
je     11df <main+0x9f>
movl   $0x20,0x4(%rsp,%rax,4)
cmp    $0x2,%eax
je     11df <main+0x9f>
movl   $0x20,0x8(%rsp,%rax,4)
mov    %rsp,%rdi
call   1030 <char_to_digit@plt>
mov    %eax,%edi
call   1050 <encrypt@plt>
lea    0xe12(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [7 x i8] c" %11i\0A\00"
@.str.1 = [7 x i8] c" %10i\0A\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = tail call i64 (...) @getchar()
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
store i32 %4, i32* %5
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %6, %4
br i1 %7, label %45, label %8
8: ; preds = %0, %16
%9 = phi i32 [ %17, %16 ], [ 0, %0 ]
%10 = add nsw i32 %9, 1
%11 = icmp eq i32 %10, 4
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = call i32 @char_to_digit(i32* %5)
%14 = call i32 @encrypt(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %12, %8
%17 = phi i32 [ 0, %12 ], [ %10, %8 ]
%18 = call i64 (...) @getchar()
%19 = trunc i64 %18 to i32
%20 = sext i32 %17 to i64
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 %20
store i32 %19, i32* %21
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %22, %19
br i1 %23, label %24, label %8
24: ; preds = %16
%25 = icmp sgt i32 %17, 0
br i1 %25, label %26, label %45
26: ; preds = %24
%27 = icmp ult i32 %17, 4
br i1 %27, label %28, label %34
28: ; preds = %26
%29 = zext i32 %17 to i64
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 %29
store i32 32, i32* %30
%31 = add nuw nsw i64 %29, 1
%32 = trunc i64 %31 to i32
%33 = icmp eq i32 %32, 4
br i1 %33, label %34, label %38
34: ; preds = %28, %38, %43, %26
%35 = call i32 @char_to_digit(i32* %5)
%36 = call i32 @encrypt(i32 %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %45
38: ; preds = %28
%39 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 %31
store i32 32, i32* %39
%40 = add nuw nsw i64 %29, 2
%41 = trunc i64 %40 to i32
%42 = icmp eq i32 %41, 4
br i1 %42, label %34, label %43
43: ; preds = %38
%44 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 %40
store i32 32, i32* %44
br label %34
45: ; preds = %0, %34, %24
ret i32 0
}