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

/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
char toupper(char);
int main(void) {
  char character[50];
  int i, n;
  printf("enter the character: ");
  for (n = 0; n < ((int)(sizeof(character) / sizeof(character[0]))); n++) {
    if ((character[n] = getchar()) == '\n')
      break;
    character[n] = toupper(character[n]);
  }
  printf("BIFF-speak: \n");
  for (i = 0; i < n; i++) {
    switch (character[i]) {
    case 'A':
      putchar('4');
      break;
    case 'B':
      putchar('8');
      break;
    case 'E':
      putchar('3');
      break;
    case 'I':
      putchar('1');
      break;
    case 'O':
      putchar('0');
      break;
    case 'S':
      putchar('5');
      break;
    default:
      putchar(character[i]);
    }
  }
  printf("!!!!!!!!!!\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xef6(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0x32,-0x48(%rbp)
jge    11b2 <main+0x72>
mov    $0x0,%al
call   1060 <getchar@plt>
movslq -0x48(%rbp),%rcx
mov    %al,-0x40(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
jne    118c <main+0x4c>
jmp    11b2 <main+0x72>
movslq -0x48(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%edi
call   1040 <toupper@plt>
mov    %al,%cl
movslq -0x48(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1162 <main+0x22>
lea    0xea9(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    127b <main+0x13b>
movslq -0x44(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
sub    $0x12,%eax
ja     125a <main+0x11a>
mov    -0x50(%rbp),%rax
lea    0xe09(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x34,%edi
call   1030 <putchar@plt>
jmp    1268 <main+0x128>
mov    $0x38,%edi
call   1030 <putchar@plt>
jmp    1268 <main+0x128>
mov    $0x33,%edi
call   1030 <putchar@plt>
jmp    1268 <main+0x128>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    1268 <main+0x128>
mov    $0x30,%edi
call   1030 <putchar@plt>
jmp    1268 <main+0x128>
mov    $0x35,%edi
call   1030 <putchar@plt>
jmp    1268 <main+0x128>
movslq -0x44(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
jmp    126d <main+0x12d>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11c5 <main+0x85>
lea    0xdee(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xeec(%rip),%rdi
call   1060 <printf@plt>
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %al,(%rsp,%r14,1)
cmp    $0xa,%al
je     11a9 <main+0x59>
movsbl %al,%edi
call   1040 <toupper@plt>
mov    %al,(%rsp,%r14,1)
add    $0x1,%r14
cmp    $0x32,%r14
jne    1170 <main+0x20>
lea    0xec6(%rip),%rdi
call   1050 <puts@plt>
mov    $0x32,%r14d
jmp    11ba <main+0x6a>
lea    0xeb2(%rip),%rdi
call   1050 <puts@plt>
test   %r14d,%r14d
je     120c <main+0xbc>
xor    %ebx,%ebx
lea    0xe3d(%rip),%r15
jmp    11e1 <main+0x91>
mov    %ecx,%eax
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
je     120c <main+0xbc>
movsbl (%rsp,%rbx,1),%ecx
lea    -0x41(%rcx),%edx
cmp    $0x12,%edx
ja     11c5 <main+0x75>
mov    $0x34,%al
movslq (%r15,%rdx,4),%rdx
add    %r15,%rdx
jmp    *%rdx
mov    $0x38,%al
jmp    11d0 <main+0x80>
mov    $0x33,%al
jmp    11d0 <main+0x80>
mov    $0x31,%al
jmp    11d0 <main+0x80>
mov    $0x30,%al
jmp    11d0 <main+0x80>
mov    $0x35,%al
jmp    11d0 <main+0x80>
lea    0xe5c(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"enter the character: \00"
@.str.1 = [14 x i8] c"BIFF-speak: \0A\00"
@.str.2 = [13 x i8] c"!!!!!!!!!!\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %6
6: ; preds = %26, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 50
br i1 %8, label %9, label %29
9: ; preds = %6
%10 = call signext i8 (...) @getchar()
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %12
store i8 %10, i8* %13
%14 = sext i8 %10 to i32
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %17
16: ; preds = %9
br label %29
17: ; preds = %9
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = call signext i8 @toupper(i8 signext %21)
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %24
store i8 %22, i8* %25
br label %26
26: ; preds = %17
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %6
29: ; preds = %16, %6
%30 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %31
31: ; preds = %60, %29
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %63
35: ; preds = %31
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
switch i32 %40, label %53 [
i32 65, label %41
i32 66, label %43
i32 69, label %45
i32 73, label %47
i32 79, label %49
i32 83, label %51
]
41: ; preds = %35
%42 = call i32 @putchar(i8 signext 52)
br label %59
43: ; preds = %35
%44 = call i32 @putchar(i8 signext 56)
br label %59
45: ; preds = %35
%46 = call i32 @putchar(i8 signext 51)
br label %59
47: ; preds = %35
%48 = call i32 @putchar(i8 signext 49)
br label %59
49: ; preds = %35
%50 = call i32 @putchar(i8 signext 48)
br label %59
51: ; preds = %35
%52 = call i32 @putchar(i8 signext 53)
br label %59
53: ; preds = %35
%54 = load i32, i32* %3
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = call i32 @putchar(i8 signext %57)
br label %59
59: ; preds = %53, %51, %49, %47, %45, %43, %41
br label %60
60: ; preds = %59
%61 = load i32, i32* %3
%62 = add nsw i32 %61, 1
store i32 %62, i32* %3
br label %31
63: ; preds = %31
%64 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"enter the character: \00"
@str = [13 x i8] c"BIFF-speak: \00"
@str.3 = [12 x i8] c"!!!!!!!!!!\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %9
%5 = phi i64 [ 0, %0 ], [ %11, %9 ]
%6 = tail call signext i8 (...) @getchar()
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %5
store i8 %6, i8* %7
%8 = icmp eq i8 %6, 10
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = tail call signext i8 @toupper(i8 signext %6)
store i8 %10, i8* %7
%11 = add nuw nsw i64 %5, 1
%12 = icmp eq i64 %11, 50
br i1 %12, label %13, label %4
13: ; preds = %9
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %19
15: ; preds = %4
%16 = trunc i64 %5 to i32
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%18 = icmp eq i32 %16, 0
br i1 %18, label %38, label %19
19: ; preds = %13, %15
%20 = phi i64 [ 50, %13 ], [ %5, %15 ]
%21 = and i64 %20, 4294967295
br label %22
22: ; preds = %19, %33
%23 = phi i64 [ 0, %19 ], [ %36, %33 ]
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
switch i32 %26, label %32 [
i32 65, label %33
i32 66, label %27
i32 69, label %28
i32 73, label %29
i32 79, label %30
i32 83, label %31
]
27: ; preds = %22
br label %33
28: ; preds = %22
br label %33
29: ; preds = %22
br label %33
30: ; preds = %22
br label %33
31: ; preds = %22
br label %33
32: ; preds = %22
br label %33
33: ; preds = %22, %27, %28, %29, %30, %31, %32
%34 = phi i8 [ 56, %27 ], [ 51, %28 ], [ 49, %29 ], [ 48, %30 ], [ 53, %31 ], [ %25, %32 ], [ 52, %22 ]
%35 = tail call i32 @putchar(i8 signext %34)
%36 = add nuw nsw i64 %23, 1
%37 = icmp eq i64 %36, %21
br i1 %37, label %38, label %22
38: ; preds = %33, %15
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}