#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*/ encrypt(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, char *);
int /*<<< orphan*/ strip_linefeed(char *);
int main() {
  char msg[80];
  printf("Type msg to be encrypted (CTRL+D to end)\n");
  while (scanf("%79s", msg) > 0) {
    strip_linefeed(msg);
    encrypt(msg);
    printf("%s\n", msg);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1060 <scanf@plt>
cmp    $0x0,%rax
jle    11a0 <main+0x60>
lea    -0x60(%rbp),%rdi
call   1030 <strip_linefeed@plt>
lea    -0x60(%rbp),%rdi
call   1050 <encrypt@plt>
lea    -0x60(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    115d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
test   %rax,%rax
jle    11a8 <main+0x68>
mov    %rsp,%rbx
lea    0xe8f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <strip_linefeed@plt>
mov    %rbx,%rdi
call   1050 <encrypt@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
test   %rax,%rax
jg     1180 <main+0x40>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Type msg to be encrypted (CTRL+D to end)\0A\00"
@.str.1 = [5 x i8] c"%79s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %8, %0
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%10 = call i32 @strip_linefeed(i8* %9)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%12 = call i32 @encrypt(i8* %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %4
15: ; preds = %4
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%79s\00"
@str = [41 x i8] c"Type msg to be encrypted (CTRL+D to end)\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%4 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %0, %6
%7 = call i32 @strip_linefeed(i8* %2)
%8 = call i32 @encrypt(i8* %2)
%9 = call i32 @puts(i8* %2)
%10 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%11 = icmp sgt i64 %10, 0
br i1 %11, label %6, label %12
12: ; preds = %6, %0
ret i32 0
}