#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 ssize_t;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
char *rot13(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
size_t strcspn(char *, char *);
int main(int argc, char **argv) {
  while (true) {
    char *line = NULL;
    size_t len = 0;
    ssize_t read;
    printf("Enter your string: ");
    read = getline(&line, &len, stdin);
    if (read == -1 || strcmp(line, "0\n") == 0) {
      break;
    }
    line[strcspn(line, "\r\n")] = 0;
    const char *rotated = rot13(line);
    printf("%s=%s\n", line, rotated);
    free((void *)rotated);
    free(line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <getline@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
je     11d1 <main+0x71>
mov    -0x18(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11d6 <main+0x76>
jmp    1233 <main+0xd3>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe2e(%rip),%rsi
call   1060 <strcspn@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1040 <rot13@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1176 <main+0x16>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1080 <getline@plt>
cmp    $0xffffffff,%eax
je     126d <main+0x10d>
lea    0xe5e(%rip),%r12
lea    0xe43(%rip),%r13
lea    0x8(%rsp),%r15
lea    0x10(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     126d <main+0x10d>
mov    0x8(%rsp),%r14
mov    %r14,%rdi
lea    0xe22(%rip),%rsi
call   1060 <strcspn@plt>
movb   $0x0,(%r14,%rax,1)
mov    0x8(%rsp),%rdi
call   1040 <rot13@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rsi
lea    0xe02(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d91(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
call   1080 <getline@plt>
cmp    $0xffffffff,%eax
jne    11d0 <main+0x70>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter your string: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [3 x i8] c"\0D\0A\00"
@.str.3 = [7 x i8] c"%s=%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %2, %21
store i8* null, i8** %6
store i64 0, i64* %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @stdin
%13 = call i32 @getline(i8** %6, i64* %7, i32 %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = icmp eq i32 %14, -1
br i1 %15, label %20, label %16
16: ; preds = %10
%17 = load i8*, i8** %6
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16, %10
br label %35
21: ; preds = %16
%22 = load i8*, i8** %6
%23 = load i8*, i8** %6
%24 = call i64 @strcspn(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 0, i8* %25
%26 = load i8*, i8** %6
%27 = call i8* @rot13(i8* %26)
store i8* %27, i8** %9
%28 = load i8*, i8** %6
%29 = load i8*, i8** %9
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %28, i8* %29)
%31 = load i8*, i8** %9
%32 = call i32 @free(i8* %31)
%33 = load i8*, i8** %6
%34 = call i32 @free(i8* %33)
br label %10
35: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter your string: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [3 x i8] c"\0D\0A\00"
@.str.3 = [7 x i8] c"%s=%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
%6 = bitcast i64* %4 to i8*
store i8* null, i8** %3
store i64 0, i64* %4
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @getline(i8** %3, i64* %4, i32 %8)
%10 = icmp eq i32 %9, -1
br i1 %10, label %30, label %11
11: ; preds = %2, %15
%12 = load i8*, i8** %3
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %30, label %15
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = call i64 @strcspn(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8 0, i8* %18
%19 = load i8*, i8** %3
%20 = call i8* @rot13(i8* %19)
%21 = load i8*, i8** %3
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %21, i8* %20)
%23 = call i32 @free(i8* %20)
%24 = load i8*, i8** %3
%25 = call i32 @free(i8* %24)
store i8* null, i8** %3
store i64 0, i64* %4
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%27 = load i32, i32* @stdin
%28 = call i32 @getline(i8** %3, i64* %4, i32 %27)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %11
30: ; preds = %15, %11, %2
ret i32 0
}