#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 */
char getchar();
scalar_t__ isalpha(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int main(void) {
  char ch;
  printf("Enter characters to by cyphered:\n");
  while ((ch = getchar()) != '\n') {
    if (isalpha(ch)) {
      putchar(ch);
    } else {
      putchar(ch + 1);
    }
  }
  putchar(ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11a6 <main+0x66>
movsbl -0x5(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     1192 <main+0x52>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    11a1 <main+0x61>
movsbl -0x5(%rbp),%eax
add    $0x1,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    115b <main+0x1b>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
nopl   (%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     1176 <main+0x36>
movsbl %al,%ebx
mov    %ebx,%edi
call   1060 <isalpha@plt>
cmp    $0x1,%rax
adc    $0x0,%bl
movsbl %bl,%edi
call   1030 <putchar@plt>
jmp    1150 <main+0x10>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Enter characters to by cyphered:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %21, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load i8, i8* %2
%10 = call i64 @isalpha(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i8, i8* %2
%14 = call i32 @putchar(i8 signext %13)
br label %21
15: ; preds = %8
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = add nsw i32 %17, 1
%19 = trunc i32 %18 to i8
%20 = call i32 @putchar(i8 signext %19)
br label %21
21: ; preds = %15, %12
br label %4
22: ; preds = %4
%23 = load i8, i8* %2
%24 = call i32 @putchar(i8 signext %23)
ret i32 0
}

LLVM IR (-O2):
@str = [33 x i8] c"Enter characters to by cyphered:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %13, label %4
4: ; preds = %0, %4
%5 = phi i8 [ %11, %4 ], [ %2, %0 ]
%6 = tail call i64 @isalpha(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i8
%9 = add i8 %5, %8
%10 = tail call i32 @putchar(i8 signext %9)
%11 = tail call signext i8 (...) @getchar()
%12 = icmp eq i8 %11, 10
br i1 %12, label %13, label %4
13: ; preds = %4, %0
%14 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}