#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*/ cmp_str_helper(char *, char *, int);
void test_cmp_strs() {
  cmp_str_helper("aaaa", "aaaa", 0);
  cmp_str_helper("bbbb", "aaaa", 1);
  cmp_str_helper("aaaa", "bbbb", -1);
  cmp_str_helper("", "", 0);
  cmp_str_helper("", "aaaa", -1);
  cmp_str_helper("aaaa", "", 1);
  cmp_str_helper("aaaa", "aaa", 1);
  cmp_str_helper("aaaa", "aaaaa", -1);
}


x86 assembly (clang, -O0):
<test_cmp_strs>:
push   %rbp
mov    %rsp,%rbp
lea    0xeeb(%rip),%rsi
xor    %edx,%edx
mov    %rsi,%rdi
call   1030 <cmp_str_helper@plt>
lea    0xed4(%rip),%rdi
lea    0xed3(%rip),%rsi
mov    $0x1,%edx
call   1030 <cmp_str_helper@plt>
lea    0xec2(%rip),%rdi
lea    0xeb5(%rip),%rsi
mov    $0xffffffff,%edx
call   1030 <cmp_str_helper@plt>
lea    0xeae(%rip),%rsi
xor    %edx,%edx
mov    %rsi,%rdi
call   1030 <cmp_str_helper@plt>
lea    0xe9d(%rip),%rdi
lea    0xe92(%rip),%rsi
mov    $0xffffffff,%edx
call   1030 <cmp_str_helper@plt>
lea    0xe81(%rip),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x1,%edx
call   1030 <cmp_str_helper@plt>
lea    0xe69(%rip),%rdi
lea    0xe63(%rip),%rsi
mov    $0x1,%edx
call   1030 <cmp_str_helper@plt>
lea    0xe51(%rip),%rdi
lea    0xe49(%rip),%rsi
mov    $0xffffffff,%edx
call   1030 <cmp_str_helper@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_cmp_strs>:
push   %r15
push   %r14
push   %rbx
lea    0xeea(%rip),%r15
mov    %r15,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1030 <cmp_str_helper@plt>
lea    0xed0(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1030 <cmp_str_helper@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0xffffffff,%edx
call   1030 <cmp_str_helper@plt>
lea    0xeb3(%rip),%rbx
mov    %rbx,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <cmp_str_helper@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xffffffff,%edx
call   1030 <cmp_str_helper@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <cmp_str_helper@plt>
lea    0xe7c(%rip),%rsi
mov    %r15,%rdi
mov    $0x1,%edx
call   1030 <cmp_str_helper@plt>
lea    0xe66(%rip),%rsi
mov    %r15,%rdi
mov    $0xffffffff,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <cmp_str_helper@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"aaaa\00"
@.str.1 = [5 x i8] c"bbbb\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [4 x i8] c"aaa\00"
@.str.4 = [6 x i8] c"aaaaa\00"
define void @test_cmp_strs() {
%1 = call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%4 = call i32 @cmp_str_helper(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 0)
%5 = call i32 @cmp_str_helper(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 -1)
%6 = call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 1)
%7 = call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 1)
%8 = call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 -1)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"aaaa\00"
@.str.1 = [5 x i8] c"bbbb\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [4 x i8] c"aaa\00"
@.str.4 = [6 x i8] c"aaaaa\00"
define void @test_cmp_strs() {
%1 = tail call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = tail call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%4 = tail call i32 @cmp_str_helper(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 0)
%5 = tail call i32 @cmp_str_helper(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 -1)
%6 = tail call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 1)
%7 = tail call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 1)
%8 = tail call i32 @cmp_str_helper(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 -1)
ret void
}