#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*/ printf(char *);
int /*<<< orphan*/ rot13(char *, int);
scalar_t__ scanf(char *, char *);
int main() {
  char masiv[1000];
  int first = 1;
  printf("Enter option: ");
  while (scanf("%1000s", masiv) && (masiv[0] != 'q')) {
    rot13(masiv, first);
    first = 0;
    printf("\nEnter option: ");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x3f4(%rbp)
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1050 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x3f5(%rbp)
je     1193 <main+0x63>
movsbl -0x3f0(%rbp),%eax
cmp    $0x71,%eax
setne  %al
mov    %al,-0x3f5(%rbp)
mov    -0x3f5(%rbp),%al
test   $0x1,%al
jne    11a6 <main+0x76>
jmp    11d3 <main+0xa3>
lea    -0x3f0(%rbp),%rdi
mov    -0x3f4(%rbp),%esi
call   1030 <rot13@plt>
movl   $0x0,-0x3f4(%rbp)
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
jmp    1158 <main+0x28>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
test   %rax,%rax
je     11d8 <main+0xa8>
cmpb   $0x71,(%rsp)
je     11d8 <main+0xa8>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <rot13@plt>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
test   %rax,%rax
je     11d8 <main+0xa8>
cmpb   $0x71,(%rsp)
je     11d8 <main+0xa8>
mov    %rsp,%rbx
lea    0xe65(%rip),%r14
lea    0xe57(%rip),%r15
nopl   0x0(%rax)
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <rot13@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
test   %rax,%rax
je     11d8 <main+0xa8>
cmpb   $0x71,(%rsp)
jne    11b0 <main+0x80>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter option: \00"
@.str.1 = [7 x i8] c"%1000s\00"
@.str.2 = [16 x i8] c"\0AEnter option: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %16, %0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%7 = call i64 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 113
br label %14
14: ; preds = %9, %5
%15 = phi i1 [ false, %5 ], [ %13, %9 ]
br i1 %15, label %16, label %21
16: ; preds = %14
%17 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%18 = load i32, i32* %3
%19 = call i32 @rot13(i8* %17, i32 %18)
store i32 0, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %5
21: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter option: \00"
@.str.1 = [7 x i8] c"%1000s\00"
@.str.2 = [16 x i8] c"\0AEnter option: \00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = icmp ne i64 %4, 0
%6 = load i8, i8* %2
%7 = icmp ne i8 %6, 113
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %9, label %25
9: ; preds = %0
%10 = call i32 @rot13(i8* %2, i32 1)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%12 = call i64 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%13 = icmp ne i64 %12, 0
%14 = load i8, i8* %2
%15 = icmp ne i8 %14, 113
%16 = select i1 %13, i1 %15, i1 false
br i1 %16, label %17, label %25
17: ; preds = %9, %17
%18 = call i32 @rot13(i8* %2, i32 0)
%19 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%20 = call i64 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%21 = icmp ne i64 %20, 0
%22 = load i8, i8* %2
%23 = icmp ne i8 %22, 113
%24 = select i1 %21, i1 %23, i1 false
br i1 %24, label %17, label %25
25: ; preds = %17, %9, %0
ret i32 0
}