#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*/ execl(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(int argc, char *argv[]) {
  char input;
  printf("#########################################\n"
         "#                                       #\n"
         "#      	  This is our I/O test!         #\n"
         "#        Key in @ to exit I/O test      #\n"
         "#                                       #\n"
         "#########################################\n");
  while (1) {
    scanf("%c", &input);
    printf("output: %c \n", input);
    if (input == '@')
      break;
  }
  printf("#########################################\n"
         "#                                       #\n"
         "#      	     Enter Bash!!               #\n"
         "#                                       #\n"
         "#########################################\n");
  execl("/bin/bash", "/bin/bash", NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfa2(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x11(%rbp),%esi
lea    0xf91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x40,%eax
jne    1188 <main+0x58>
jmp    118d <main+0x5d>
jmp    1154 <main+0x24>
lea    0xf79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x103e(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1050 <execl@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%r14
lea    0xf(%rsp),%r15
lea    0xe9b(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpb   $0x40,0xf(%rsp)
jne    1170 <main+0x30>
lea    0xf7e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6c(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1060 <execl@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [253 x i8] c"#########################################\0A# #\0A# \09 This is our I/O test! #\0A# Key in @ to exit I/O test #\0A# #\0A#########################################\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [13 x i8] c"output: %c \0A\00"
@.str.3 = [211 x i8] c"#########################################\0A# #\0A# \09 Enter Bash!! #\0A# #\0A#########################################\0A\00"
@.str.4 = [10 x i8] c"/bin/bash\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([253 x i8], [253 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %17
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 64
br i1 %15, label %16, label %17
16: ; preds = %8
br label %18
17: ; preds = %8
br label %8
18: ; preds = %16
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([211 x i8], [211 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @execl(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [13 x i8] c"output: %c \0A\00"
@.str.4 = [10 x i8] c"/bin/bash\00"
@str = [252 x i8] c"#########################################\0A# #\0A# \09 This is our I/O test! #\0A# Key in @ to exit I/O test #\0A# #\0A#########################################\00"
@str.5 = [210 x i8] c"#########################################\0A# #\0A# \09 Enter Bash!! #\0A# #\0A#########################################\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([252 x i8], [252 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %5, %2
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i8, i8* %3
%11 = icmp eq i8 %10, 64
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([210 x i8], [210 x i8]* @str.5, i64 0, i64 0))
%14 = call i32 @execl(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32* null)
ret i32 0
}