#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*/ gets(char *);
int my_strcmp(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int strcmp(char *, char *);
int main(int argc, const char *argv[]) {
  char s1[255], s2[255];
  gets(s1);
  gets(s2);
  printf("my_strcmp = %d\n", my_strcmp(s1, s2));
  printf("   strcmp = %d\n", strcmp(s1, s2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x210(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1030 <my_strcmp@plt>
mov    %eax,%esi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,%esi
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x208,%rsp
lea    0x100(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <my_strcmp@plt>
lea    0xe89(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
lea    0xe80(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c"my_strcmp = %d\0A\00"
@.str.1 = [16 x i8] c" strcmp = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [255 x i8]
%7 = alloca [255 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%9 = call i32 @gets(i8* %8)
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%11 = call i32 @gets(i8* %10)
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%14 = call i32 @my_strcmp(i8* %12, i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%18 = call i32 @strcmp(i8* %16, i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"my_strcmp = %d\0A\00"
@.str.1 = [16 x i8] c" strcmp = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [255 x i8]
%4 = alloca [255 x i8]
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%7 = call i32 @gets(i8* %5)
%8 = call i32 @gets(i8* %6)
%9 = call i32 @my_strcmp(i8* %5, i8* %6)
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @strcmp(i8* %5, i8* %6)
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}