#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 GetValueLength(int);
int /*<<< orphan*/ strcmp(char const *, char *);
int BetSumXByHorse(const char *horse, int value) {
  if (!strcmp(horse, "red")) {
    return 0;
  } else if (!strcmp(horse, "blue")) {
    return 640 - GetValueLength(value);
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<BetSumXByHorse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1154 <BetSumXByHorse+0x34>
movl   $0x0,-0x4(%rbp)
jmp    118d <BetSumXByHorse+0x6d>
mov    -0x10(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1186 <BetSumXByHorse+0x66>
mov    -0x14(%rbp),%edi
call   1040 <GetValueLength@plt>
mov    %eax,%ecx
mov    $0x280,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    118d <BetSumXByHorse+0x6d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BetSumXByHorse>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1164 <BetSumXByHorse+0x44>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
jne    1166 <BetSumXByHorse+0x46>
mov    %ebp,%edi
call   1040 <GetValueLength@plt>
mov    %eax,%ecx
mov    $0x280,%eax
sub    %ecx,%eax
jmp    1166 <BetSumXByHorse+0x46>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"red\00"
@.str.1 = [5 x i8] c"blue\00"
define i32 @BetSumXByHorse(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %2
store i32 0, i32* %3
br label %19
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = call i32 @GetValueLength(i32 %15)
%17 = sub nsw i32 640, %16
store i32 %17, i32* %3
br label %19
18: ; preds = %10
store i32 -1, i32* %3
br label %19
19: ; preds = %18, %14, %9
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [4 x i8] c"red\00"
@.str.1 = [5 x i8] c"blue\00"
define i32 @BetSumXByHorse(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i32 @GetValueLength(i32 %1)
%10 = sub nsw i32 640, %9
br label %11
11: ; preds = %5, %2, %8
%12 = phi i32 [ %10, %8 ], [ 0, %2 ], [ -1, %5 ]
ret i32 %12
}