#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 fun(char *, char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char a[100] = "this is a book.", b[20];
  gets(b);
  printf("%d", fun(a, b));
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x64,%edx
call   1060 <memcpy@plt>
lea    -0x90(%rbp),%rdi
call   1070 <gets@plt>
lea    -0x70(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <fun@plt>
mov    %eax,%esi
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x90,%rsp
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xead(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe91(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe75(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <fun@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [100 x i8] c"this is a book.\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [20 x i8]
store i32 0, i32* %1
%4 = bitcast [100 x i8]* %2 to i8*
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%9 = call i32 @fun(i8* %7, i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [100 x i8] c"this is a book.\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = call i32 @fun(i8* %3, i8* %4)
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (...) @getchar()
ret i32 0
}