#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 /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int sscanf(char *, char *, char *);
int /*<<< orphan*/ stdin;
int main() {
  char buffer[1100], str[1001];
  if (fgets(buffer, sizeof(buffer), stdin) == NULL) {
    exit(EXIT_FAILURE);
  }
  if (sscanf(buffer, "%s", str) != 1) {
    exit(EXIT_FAILURE);
  }
  for (int i = 0; str[i] != '\0'; i++) {
    if (str[i] >= 'a' && str[i] <= 'z') {
      str[i] -= 'a' - 'A';
    } else if (str[i] >= 'A' && str[i] <= 'Z') {
      str[i] += 'a' - 'A';
    }
  }
  printf("%s", str);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x850,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x450(%rbp),%rdi
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
mov    $0x44c,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    1184 <main+0x44>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
lea    -0x450(%rbp),%rdi
lea    -0x840(%rbp),%rdx
lea    0xe67(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     11b5 <main+0x75>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
movl   $0x0,-0x844(%rbp)
movslq -0x844(%rbp),%rax
movsbl -0x840(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     128c <main+0x14c>
movslq -0x844(%rbp),%rax
movsbl -0x840(%rbp,%rax,1),%eax
ff
cmp    $0x61,%eax
jl     1225 <main+0xe5>
movslq -0x844(%rbp),%rax
movsbl -0x840(%rbp,%rax,1),%eax
ff
cmp    $0x7a,%eax
jg     1225 <main+0xe5>
movslq -0x844(%rbp),%rax
movsbl -0x840(%rbp,%rax,1),%ecx
ff
sub    $0x20,%ecx
mov    %cl,-0x840(%rbp,%rax,1)
jmp    1273 <main+0x133>
movslq -0x844(%rbp),%rax
movsbl -0x840(%rbp,%rax,1),%eax
ff
cmp    $0x41,%eax
jl     126e <main+0x12e>
movslq -0x844(%rbp),%rax
movsbl -0x840(%rbp,%rax,1),%eax
ff
cmp    $0x5a,%eax
jg     126e <main+0x12e>
movslq -0x844(%rbp),%rax
movsbl -0x840(%rbp,%rax,1),%ecx
ff
add    $0x20,%ecx
mov    %cl,-0x840(%rbp,%rax,1)
jmp    1273 <main+0x133>
jmp    1278 <main+0x138>
mov    -0x844(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x844(%rbp)
jmp    11bf <main+0x7f>
lea    -0x840(%rbp),%rsi
lea    0xd66(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d2a(%rip),%rax
mov    (%rax),%eax
add    $0x850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x848,%rsp
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
lea    0x3f0(%rsp),%rdi
mov    $0x44c,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11e8 <main+0xa8>
lea    0xe8e(%rip),%rsi
lea    0x3f0(%rsp),%rdi
mov    %rsp,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11e8 <main+0xa8>
mov    (%rsp),%al
test   %al,%al
je     11c8 <main+0x88>
lea    0x1(%rsp),%rcx
jmp    11b0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
nop
add    %dl,%al
mov    %al,-0x1(%rcx)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
je     11c8 <main+0x88>
lea    -0x61(%rax),%esi
mov    $0xe0,%dl
cmp    $0x1a,%sil
jb     11a0 <main+0x60>
lea    -0x41(%rax),%esi
mov    $0x20,%dl
cmp    $0x19,%sil
jbe    11a0 <main+0x60>
jmp    11a5 <main+0x65>
lea    0xe31(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%eax
add    $0x848,%rsp
ret
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1100 x i8]
%3 = alloca [1001 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [1100 x i8], [1100 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32* @fgets(i8* %5, i32 1100, i32 %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %0
%13 = getelementptr inbounds [1100 x i8], [1100 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%15 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = icmp ne i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %12
store i32 0, i32* %4
br label %21
21: ; preds = %74, %20
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %77
28: ; preds = %21
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp sge i32 %33, 97
br i1 %34, label %35, label %50
35: ; preds = %28
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp sle i32 %40, 122
br i1 %41, label %42, label %50
42: ; preds = %35
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = sub nsw i32 %47, 32
%49 = trunc i32 %48 to i8
store i8 %49, i8* %45
br label %73
50: ; preds = %35, %28
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp sge i32 %55, 65
br i1 %56, label %57, label %72
57: ; preds = %50
%58 = load i32, i32* %4
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp sle i32 %62, 90
br i1 %63, label %64, label %72
64: ; preds = %57
%65 = load i32, i32* %4
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = add nsw i32 %69, 32
%71 = trunc i32 %70 to i8
store i8 %71, i8* %67
br label %72
72: ; preds = %64, %57, %50
br label %73
73: ; preds = %72, %42
br label %74
74: ; preds = %73
%75 = load i32, i32* %4
%76 = add nsw i32 %75, 1
store i32 %76, i32* %4
br label %21
77: ; preds = %21
%78 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%79 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %78)
%80 = load i32, i32* @EXIT_SUCCESS
ret i32 %80
}

LLVM IR (-O2):
@stdin = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [1100 x i8]
%2 = alloca [1001 x i8]
%3 = getelementptr inbounds [1100 x i8], [1100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32* @fgets(i8* %3, i32 1100, i32 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
%12 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i8, i8* %4
%16 = icmp eq i8 %15, 0
br i1 %16, label %20, label %23
17: ; preds = %11
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %35, %14
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
23: ; preds = %14, %35
%24 = phi i64 [ %36, %35 ], [ 0, %14 ]
%25 = phi i8 [ %38, %35 ], [ %15, %14 ]
%26 = phi i8* [ %37, %35 ], [ %4, %14 ]
%27 = add i8 %25, -97
%28 = icmp ult i8 %27, 26
br i1 %28, label %32, label %29
29: ; preds = %23
%30 = add i8 %25, -65
%31 = icmp ult i8 %30, 26
br i1 %31, label %32, label %35
32: ; preds = %29, %23
%33 = phi i8 [ -32, %23 ], [ 32, %29 ]
%34 = add nsw i8 %25, %33
store i8 %34, i8* %26
br label %35
35: ; preds = %32, %29
%36 = add nuw i64 %24, 1
%37 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 0
br i1 %39, label %20, label %23
}