#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 mystrcmp(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *, int);
void test4() {
  int result;
  char *s1, *s2;
  s1 = "banana";
  s2 = "apple";
  result = mystrcmp(s1, s2);
  printf("mystrcmp(\"%s\", \"%s\")=%d\n", s1, s2, result);
  s1 = "apple";
  s2 = "banana";
  result = mystrcmp(s1, s2);
  printf("mystrcmp(\"%s\", \"%s\")=%d\n", s1, s2, result);
  s1 = "appleapple";
  s2 = "applebanana";
  result = mystrcmp(s1, s2);
  printf("mystrcmp(\"%s\", \"%s\")=%d\n", s1, s2, result);
  s1 = "applebanana";
  s2 = "appleapple";
  result = mystrcmp(s1, s2);
  printf("mystrcmp(\"%s\", \"%s\")=%d\n", s1, s2, result);
  s1 = "apple";
  s2 = "apple";
  result = mystrcmp(s1, s2);
  printf("mystrcmp(\"%s\", \"%s\")=%d\n", s1, s2, result);
  s1 = "appleapple";
  s2 = "apple";
  result = mystrcmp(s1, s2);
  printf("mystrcmp(\"%s\", \"%s\")=%d\n", s1, s2, result);
  s1 = "apple";
  s2 = "applebanana";
  result = mystrcmp(s1, s2);
  printf("mystrcmp(\"%s\", \"%s\")=%d\n", s1, s2, result);
  s1 = "applebanana";
  s2 = "apple";
  result = mystrcmp(s1, s2);
  printf("mystrcmp(\"%s\", \"%s\")=%d\n", s1, s2, result);
}


x86 assembly (clang, -O0):
<test4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xefa(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xee4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mystrcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeb2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mystrcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
lea    0xe70(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe70(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mystrcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xe26(%rip),%rdi
call   1040 <printf@plt>
lea    0xe3e(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe28(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mystrcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xde9(%rip),%rdi
call   1040 <printf@plt>
lea    0xdfb(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xdf0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mystrcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xdac(%rip),%rdi
call   1040 <printf@plt>
lea    0xdb9(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xdb3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mystrcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xd6f(%rip),%rdi
call   1040 <printf@plt>
lea    0xd81(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xd7c(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mystrcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xd32(%rip),%rdi
call   1040 <printf@plt>
lea    0xd4a(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xd39(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mystrcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xcf5(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xefa(%rip),%r15
lea    0xee8(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <mystrcmp@plt>
lea    0xeb8(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <mystrcmp@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
call   1040 <printf@plt>
lea    0xe9f(%rip),%r12
lea    0xea3(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <mystrcmp@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <mystrcmp@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1030 <mystrcmp@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <mystrcmp@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <mystrcmp@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <mystrcmp@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"banana\00"
@.str.1 = [6 x i8] c"apple\00"
@.str.2 = [25 x i8] c"mystrcmp(\22%s\22, \22%s\22)=%d\0A\00"
@.str.3 = [11 x i8] c"appleapple\00"
@.str.4 = [12 x i8] c"applebanana\00"
define void @test4() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = load i8*, i8** %3
%6 = call i32 @mystrcmp(i8* %4, i8* %5)
store i32 %6, i32* %1
%7 = load i8*, i8** %2
%8 = load i8*, i8** %3
%9 = load i32, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %8, i32 %9)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %3
%11 = load i8*, i8** %2
%12 = load i8*, i8** %3
%13 = call i32 @mystrcmp(i8* %11, i8* %12)
store i32 %13, i32* %1
%14 = load i8*, i8** %2
%15 = load i8*, i8** %3
%16 = load i32, i32* %1
%17 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %15, i32 %16)
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8** %3
%18 = load i8*, i8** %2
%19 = load i8*, i8** %3
%20 = call i32 @mystrcmp(i8* %18, i8* %19)
store i32 %20, i32* %1
%21 = load i8*, i8** %2
%22 = load i8*, i8** %3
%23 = load i32, i32* %1
%24 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %21, i8* %22, i32 %23)
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %3
%25 = load i8*, i8** %2
%26 = load i8*, i8** %3
%27 = call i32 @mystrcmp(i8* %25, i8* %26)
store i32 %27, i32* %1
%28 = load i8*, i8** %2
%29 = load i8*, i8** %3
%30 = load i32, i32* %1
%31 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %28, i8* %29, i32 %30)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
%32 = load i8*, i8** %2
%33 = load i8*, i8** %3
%34 = call i32 @mystrcmp(i8* %32, i8* %33)
store i32 %34, i32* %1
%35 = load i8*, i8** %2
%36 = load i8*, i8** %3
%37 = load i32, i32* %1
%38 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %35, i8* %36, i32 %37)
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
%39 = load i8*, i8** %2
%40 = load i8*, i8** %3
%41 = call i32 @mystrcmp(i8* %39, i8* %40)
store i32 %41, i32* %1
%42 = load i8*, i8** %2
%43 = load i8*, i8** %3
%44 = load i32, i32* %1
%45 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %42, i8* %43, i32 %44)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8** %3
%46 = load i8*, i8** %2
%47 = load i8*, i8** %3
%48 = call i32 @mystrcmp(i8* %46, i8* %47)
store i32 %48, i32* %1
%49 = load i8*, i8** %2
%50 = load i8*, i8** %3
%51 = load i32, i32* %1
%52 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %49, i8* %50, i32 %51)
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
%53 = load i8*, i8** %2
%54 = load i8*, i8** %3
%55 = call i32 @mystrcmp(i8* %53, i8* %54)
store i32 %55, i32* %1
%56 = load i8*, i8** %2
%57 = load i8*, i8** %3
%58 = load i32, i32* %1
%59 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %56, i8* %57, i32 %58)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"banana\00"
@.str.1 = [6 x i8] c"apple\00"
@.str.2 = [25 x i8] c"mystrcmp(\22%s\22, \22%s\22)=%d\0A\00"
@.str.3 = [11 x i8] c"appleapple\00"
@.str.4 = [12 x i8] c"applebanana\00"
define void @test4() {
%1 = tail call i32 @mystrcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%3 = tail call i32 @mystrcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @mystrcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %5)
%7 = tail call i32 @mystrcmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @mystrcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = tail call i32 @mystrcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = tail call i32 @mystrcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%14 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = tail call i32 @mystrcmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %15)
ret void
}