#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 */
scalar_t__ test_to_lower_sstring_helper(char *, char *);
int test_to_lower_sstring(void) {
  if (test_to_lower_sstring_helper("tEsTiNg", "testing"))
    return -1;
  if (test_to_lower_sstring_helper("TESTING", "testing"))
    return -2;
  if (test_to_lower_sstring_helper("testing", "testing"))
    return -3;
  if (test_to_lower_sstring_helper(NULL, NULL))
    return -4;
  if (test_to_lower_sstring_helper("", ""))
    return -5;
  return 0;
}


x86 assembly (clang, -O0):
<test_to_lower_sstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <test_to_lower_sstring_helper@plt>
cmp    $0x0,%rax
je     1141 <test_to_lower_sstring+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    11dd <test_to_lower_sstring+0xcd>
lea    0xec8(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   1030 <test_to_lower_sstring_helper@plt>
cmp    $0x0,%rax
je     116a <test_to_lower_sstring+0x5a>
movl   $0xfffffffe,-0x4(%rbp)
jmp    11dd <test_to_lower_sstring+0xcd>
lea    0xe97(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_to_lower_sstring_helper@plt>
cmp    $0x0,%rax
je     118f <test_to_lower_sstring+0x7f>
movl   $0xfffffffd,-0x4(%rbp)
jmp    11dd <test_to_lower_sstring+0xcd>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1030 <test_to_lower_sstring_helper@plt>
cmp    $0x0,%rax
je     11b1 <test_to_lower_sstring+0xa1>
movl   $0xfffffffc,-0x4(%rbp)
jmp    11dd <test_to_lower_sstring+0xcd>
lea    0xe5f(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_to_lower_sstring_helper@plt>
cmp    $0x0,%rax
je     11d6 <test_to_lower_sstring+0xc6>
movl   $0xfffffffb,-0x4(%rbp)
jmp    11dd <test_to_lower_sstring+0xcd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_to_lower_sstring>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee9(%rip),%rsi
call   1030 <test_to_lower_sstring_helper@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
je     1133 <test_to_lower_sstring+0x23>
pop    %rcx
ret
lea    0xed6(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1030 <test_to_lower_sstring_helper@plt>
mov    %rax,%rcx
mov    $0xfffffffe,%eax
test   %rcx,%rcx
jne    1131 <test_to_lower_sstring+0x21>
lea    0xeae(%rip),%rdi
mov    %rdi,%rsi
call   1030 <test_to_lower_sstring_helper@plt>
mov    %rax,%rcx
mov    $0xfffffffd,%eax
test   %rcx,%rcx
jne    1131 <test_to_lower_sstring+0x21>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <test_to_lower_sstring_helper@plt>
mov    %rax,%rcx
mov    $0xfffffffc,%eax
test   %rcx,%rcx
jne    1131 <test_to_lower_sstring+0x21>
lea    0xe8b(%rip),%rdi
mov    %rdi,%rsi
call   1030 <test_to_lower_sstring_helper@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rcx,%rcx,4),%eax
add    $0xfffffffb,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"tEsTiNg\00"
@.str.1 = [8 x i8] c"testing\00"
@.str.2 = [8 x i8] c"TESTING\00"
@.str.3 = [1 x i8] zeroinitializer
define i32 @test_to_lower_sstring() {
%1 = alloca i32
%2 = call i64 @test_to_lower_sstring_helper(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 -1, i32* %1
br label %22
5: ; preds = %0
%6 = call i64 @test_to_lower_sstring_helper(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5
store i32 -2, i32* %1
br label %22
9: ; preds = %5
%10 = call i64 @test_to_lower_sstring_helper(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 -3, i32* %1
br label %22
13: ; preds = %9
%14 = call i64 @test_to_lower_sstring_helper(i8* null, i8* null)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 -4, i32* %1
br label %22
17: ; preds = %13
%18 = call i64 @test_to_lower_sstring_helper(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 -5, i32* %1
br label %22
21: ; preds = %17
store i32 0, i32* %1
br label %22
22: ; preds = %21, %20, %16, %12, %8, %4
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [8 x i8] c"tEsTiNg\00"
@.str.1 = [8 x i8] c"testing\00"
@.str.2 = [8 x i8] c"TESTING\00"
@.str.3 = [1 x i8] zeroinitializer
define i32 @test_to_lower_sstring() {
%1 = tail call i64 @test_to_lower_sstring_helper(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %16
3: ; preds = %0
%4 = tail call i64 @test_to_lower_sstring_helper(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = tail call i64 @test_to_lower_sstring_helper(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = tail call i64 @test_to_lower_sstring_helper(i8* null, i8* null)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = tail call i64 @test_to_lower_sstring_helper(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i32 0, i32 -5
br label %16
16: ; preds = %12, %9, %6, %3, %0
%17 = phi i32 [ -1, %0 ], [ -2, %3 ], [ -3, %6 ], [ -4, %9 ], [ %15, %12 ]
ret i32 %17
}