#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 sscanf(char const *, char *, int *, int *, int *);
int COM_ReadColorRGBString(const char *in) {
  static int playerColor[3];
  if (in && in[0]) {
    if (sscanf(in, "%3i %3i %3i", &playerColor[0], &playerColor[1],
               &playerColor[2]) == 3)
      return (((playerColor[0]) << 0) | ((playerColor[1]) << 8) |
              ((playerColor[2]) << 16));
  }
  return -1;
}


x86 assembly (clang, -O0):
<COM_ReadColorRGBString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1191 <COM_ReadColorRGBString+0x81>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1191 <COM_ReadColorRGBString+0x81>
mov    -0x10(%rbp),%rdi
lea    0xebe(%rip),%rsi
lea    0x2ee3(%rip),%rdx
mov    %rdx,%rcx
add    $0x4,%rcx
mov    %rdx,%r8
add    $0x8,%r8
call   1030 <sscanf@plt>
cmp    $0x3,%eax
jne    118c <COM_ReadColorRGBString+0x7c>
mov    0x2ec1(%rip),%eax
shl    $0x0,%eax
mov    0x2ebc(%rip),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    0x2eb5(%rip),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1198 <COM_ReadColorRGBString+0x88>
jmp    1191 <COM_ReadColorRGBString+0x81>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<COM_ReadColorRGBString>:
push   %rbx
mov    $0xffffffff,%ebx
test   %rdi,%rdi
je     1160 <COM_ReadColorRGBString+0x50>
cmpb   $0x0,(%rdi)
je     1160 <COM_ReadColorRGBString+0x50>
lea    0xed9(%rip),%rsi
lea    0x2efe(%rip),%rdx
lea    0x2efb(%rip),%rcx
lea    0x2ef8(%rip),%r8
call   1030 <sscanf@plt>
cmp    $0x3,%eax
jne    1160 <COM_ReadColorRGBString+0x50>
mov    0x2ee4(%rip),%eax
shl    $0x8,%eax
or     0x2ed7(%rip),%eax
mov    0x2ed9(%rip),%ebx
shl    $0x10,%ebx
or     %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@COM_ReadColorRGBString.playerColor = internal global [3 x i32] zeroinitializer
@.str = [12 x i8] c"%3i %3i %3i\00"
define i32 @COM_ReadColorRGBString(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %26
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %26
12: ; preds = %6
%13 = load i8*, i8** %3
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 0), i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 1), i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 2))
%15 = icmp eq i32 %14, 3
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 0)
%18 = shl i32 %17, 0
%19 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 1)
%20 = shl i32 %19, 8
%21 = or i32 %18, %20
%22 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 2)
%23 = shl i32 %22, 16
%24 = or i32 %21, %23
store i32 %24, i32* %2
br label %27
25: ; preds = %12
br label %26
26: ; preds = %25, %6, %1
store i32 -1, i32* %2
br label %27
27: ; preds = %26, %16
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@COM_ReadColorRGBString.playerColor = internal global [3 x i32] zeroinitializer
@.str = [12 x i8] c"%3i %3i %3i\00"
define i32 @COM_ReadColorRGBString(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %17, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %3
%7 = tail call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 0), i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 1), i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 2))
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 0)
%11 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 1)
%12 = shl i32 %11, 8
%13 = or i32 %12, %10
%14 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @COM_ReadColorRGBString.playerColor, i64 0, i64 2)
%15 = shl i32 %14, 16
%16 = or i32 %13, %15
br label %17
17: ; preds = %1, %3, %6, %9
%18 = phi i32 [ %16, %9 ], [ -1, %6 ], [ -1, %3 ], [ -1, %1 ]
ret i32 %18
}