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

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char *buf1;
  buf1 = (char *)malloc(40);
  strcpy(buf1, "Oh look, a way out!");
  char buf0[50];
  fgets(buf0, sizeof(buf0), stdin);
  if (*buf0 == *buf1) {
    printf("Do you really think you can escape?\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x50(%rbp),%rdi
mov    0x2e70(%rip),%rax
mov    (%rax),%edx
mov    $0x32,%esi
call   1050 <fgets@plt>
movsbl -0x50(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11a3 <main+0x63>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xea7(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x32,%esi
call   1050 <fgets@plt>
mov    (%rsp),%al
cmp    (%rbx),%al
jne    118a <main+0x4a>
lea    0xe8f(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Oh look, a way out!\00"
@stdin = global i32 0
@.str.1 = [37 x i8] c"Do you really think you can escape?\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [50 x i8]
store i32 0, i32* %1
%4 = call i64 @malloc(i32 40)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 50, i32 %9)
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %13, %16
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %0
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [20 x i8] c"Oh look, a way out!\00"
@stdin = global i32 0
@str = [36 x i8] c"Do you really think you can escape?\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = tail call i64 @malloc(i32 40)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 50, i32 %6)
%8 = load i8, i8* %5
%9 = load i8, i8* %3
%10 = icmp eq i8 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %11, %0
ret i32 0
}