#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*/ alternate_case(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *test_one_alternate_case(char *msg, char *str, char *str2) {
  char temp[strlen(str)];
  strcpy(temp, str);
  alternate_case(temp);
  do {
    int result = temp != NULL;
    printf("%s", (result ? "+" : "-"));
    if (!result)
      return msg;
  } while (0);
  do {
    int result = strlen(temp) > 0;
    printf("%s", (result ? "+" : "-"));
    if (!result)
      return msg;
  } while (0);
  do {
    int result = strcmp(temp, str2) == 0;
    printf("%s", (result ? "+" : "-"));
    if (!result)
      return msg;
  } while (0);
  return (0);
}


x86 assembly (clang, -O0):
<test_one_alternate_case>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    %rcx,%rax
mov    %rsp,%rdx
mov    %rdx,-0x28(%rbp)
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x48(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x48(%rbp),%rdi
call   1060 <alternate_case@plt>
mov    -0x48(%rbp),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
lea    0xe43(%rip),%rsi
lea    0xe3a(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe29(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    11fa <test_one_alternate_case+0xaa>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x38(%rbp)
jmp    12e9 <test_one_alternate_case+0x199>
jmp    11ff <test_one_alternate_case+0xaf>
jmp    1204 <test_one_alternate_case+0xb4>
jmp    1209 <test_one_alternate_case+0xb9>
mov    -0x48(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%ecx
lea    0xdda(%rip),%rsi
lea    0xdd1(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xdc0(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x3c(%rbp)
jne    1263 <test_one_alternate_case+0x113>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x38(%rbp)
jmp    12e9 <test_one_alternate_case+0x199>
jmp    1268 <test_one_alternate_case+0x118>
jmp    126d <test_one_alternate_case+0x11d>
jmp    1272 <test_one_alternate_case+0x122>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%ecx
lea    0xd6d(%rip),%rsi
lea    0xd64(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xd53(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x40(%rbp)
jne    12d0 <test_one_alternate_case+0x180>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x38(%rbp)
jmp    12e9 <test_one_alternate_case+0x199>
jmp    12d5 <test_one_alternate_case+0x185>
jmp    12da <test_one_alternate_case+0x18a>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_one_alternate_case>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,-0x38(%rbp)
mov    %rsi,%r12
mov    %rdi,-0x30(%rbp)
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <alternate_case@plt>
lea    0xe61(%rip),%r14
lea    0xe5d(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,%r12
test   %rax,%rax
lea    0xe3f(%rip),%r13
mov    %r13,%rsi
cmovg  %r15,%rsi
mov    %r14,%rdi
call   1050 <printf@plt>
test   %r12,%r12
jle    1210 <test_one_alternate_case+0xc0>
mov    %rbx,%rdi
mov    -0x38(%rbp),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
lea    0xe13(%rip),%rcx
cmove  %rcx,%r13
lea    0xe05(%rip),%rdi
mov    -0x30(%rbp),%rbx
cmove  %rax,%rbx
mov    %r13,%rsi
call   1050 <printf@plt>
mov    %rbx,%rax
jmp    1214 <test_one_alternate_case+0xc4>
mov    -0x30(%rbp),%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [2 x i8] c"-\00"
define i8* @test_one_alternate_case(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%14 = load i8*, i8** %6
%15 = call i64 @strlen(i8* %14)
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %8
%17 = alloca i8, i64 %15
store i64 %15, i64* %9
%18 = load i8*, i8** %6
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = call i32 @alternate_case(i8* %17)
br label %21
21: ; preds = %3
%22 = icmp ne i8* %17, null
%23 = zext i1 %22 to i32
store i32 %23, i32* %10
%24 = load i32, i32* %10
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i64
%27 = select i1 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = load i32, i32* %10
%30 = icmp ne i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %21
%32 = load i8*, i8** %5
store i8* %32, i8** %4
store i32 1, i32* %11
br label %69
33: ; preds = %21
br label %34
34: ; preds = %33
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
%37 = call i64 @strlen(i8* %17)
%38 = icmp sgt i64 %37, 0
%39 = zext i1 %38 to i32
store i32 %39, i32* %12
%40 = load i32, i32* %12
%41 = icmp ne i32 %40, 0
%42 = zext i1 %41 to i64
%43 = select i1 %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%44 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %43)
%45 = load i32, i32* %12
%46 = icmp ne i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %36
%48 = load i8*, i8** %5
store i8* %48, i8** %4
store i32 1, i32* %11
br label %69
49: ; preds = %36
br label %50
50: ; preds = %49
br label %51
51: ; preds = %50
br label %52
52: ; preds = %51
%53 = load i8*, i8** %7
%54 = call i64 @strcmp(i8* %17, i8* %53)
%55 = icmp eq i64 %54, 0
%56 = zext i1 %55 to i32
store i32 %56, i32* %13
%57 = load i32, i32* %13
%58 = icmp ne i32 %57, 0
%59 = zext i1 %58 to i64
%60 = select i1 %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%61 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %60)
%62 = load i32, i32* %13
%63 = icmp ne i32 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %52
%65 = load i8*, i8** %5
store i8* %65, i8** %4
store i32 1, i32* %11
br label %69
66: ; preds = %52
br label %67
67: ; preds = %66
br label %68
68: ; preds = %67
store i8* null, i8** %4
store i32 1, i32* %11
br label %69
69: ; preds = %68, %64, %47, %31
%70 = load i8*, i8** %8
%71 = load i8*, i8** %4
ret i8* %71
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [2 x i8] c"-\00"
define i8* @test_one_alternate_case(i8* readnone %0, i8* %1, i8* %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = alloca i8, i64 %4
%6 = call i32 @strcpy(i8* %5, i8* %1)
%7 = call i32 @alternate_case(i8* %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = call i64 @strlen(i8* %5)
%10 = icmp sgt i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
br i1 %10, label %13, label %19
13: ; preds = %3
%14 = call i64 @strcmp(i8* %5, i8* %2)
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = select i1 %15, i8* null, i8* %0
br label %19
19: ; preds = %13, %3
%20 = phi i8* [ %0, %3 ], [ %18, %13 ]
ret i8* %20
}