#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 EOF;
int /*<<< orphan*/ escape(char *, char *);
int getchar();
int main(void) {
  char s[100], t[100];
  int c, i;
  for (i = 0; (c = getchar()) != EOF && i < 100; i++)
    t[i] = c;
  t[i] = '\0';
  escape(s, t);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xe8(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0xe4(%rbp)
xor    %eax,%eax
mov    0x2e94(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xe9(%rbp)
je     1172 <main+0x52>
cmpl   $0x64,-0xe8(%rbp)
setl   %al
mov    %al,-0xe9(%rbp)
mov    -0xe9(%rbp),%al
test   $0x1,%al
jne    1185 <main+0x65>
jmp    11af <main+0x8f>
mov    -0xe4(%rbp),%eax
mov    %al,%cl
movslq -0xe8(%rbp),%rax
mov    %cl,-0xe0(%rbp,%rax,1)
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
jmp    113c <main+0x1c>
movslq -0xe8(%rbp),%rax
movb   $0x0,-0xe0(%rbp,%rax,1)
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1040 <escape@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xe0,%rsp
xor    %r15d,%r15d
xor    %eax,%eax
call   1030 <getchar@plt>
mov    0x2eab(%rip),%r14
cmp    (%r14),%eax
je     116c <main+0x4c>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %al,(%rsp,%rbx,1)
lea    0x1(%rbx),%r15
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    (%r14),%eax
je     116c <main+0x4c>
cmp    $0x63,%rbx
mov    %r15,%rbx
jb     1150 <main+0x30>
movb   $0x0,(%rsp,%r15,1)
lea    0x70(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <escape@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %21, %0
%7 = call i32 (...) @getchar()
store i32 %7, i32* %4
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 100
br label %13
13: ; preds = %10, %6
%14 = phi i1 [ false, %6 ], [ %12, %10 ]
br i1 %14, label %15, label %24
15: ; preds = %13
%16 = load i32, i32* %4
%17 = trunc i32 %16 to i8
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %19
store i8 %17, i8* %20
br label %21
21: ; preds = %15
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %6
24: ; preds = %13
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %26
store i8 0, i8* %27
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%30 = call i32 @escape(i8* %28, i8* %29)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %19, label %8
8: ; preds = %0, %8
%9 = phi i64 [ %13, %8 ], [ 0, %0 ]
%10 = phi i32 [ %14, %8 ], [ %5, %0 ]
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %9
store i8 %11, i8* %12
%13 = add nuw nsw i64 %9, 1
%14 = tail call i32 (...) @getchar()
%15 = load i32, i32* @EOF
%16 = icmp ne i32 %14, %15
%17 = icmp ult i64 %9, 99
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %8, label %19
19: ; preds = %8, %0
%20 = phi i64 [ 0, %0 ], [ %13, %8 ]
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %20
store i8 0, i8* %21
%22 = call i32 @escape(i8* %3, i8* %4)
ret i32 0
}