#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ strcmp(char const *, char *);
scalar_t__ strncmp(char const *, char *, int);
void output_cm_result(const char *result, FILE *outputfile) {
  fprintf(outputfile, "%c ", ';');
  if (strcmp(result, "1-0") == 0) {
    fprintf(outputfile, "and black resigns");
  } else if (strcmp(result, "0-1") == 0) {
    fprintf(outputfile, "and white resigns");
  } else if (strncmp(result, "1/2", 3) == 0) {
    fprintf(outputfile, "draw");
  } else {
    fprintf(outputfile, "incomplete result");
  }
}


x86 assembly (clang, -O0):
<output_cm_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x3b,%edx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1188 <output_cm_result+0x58>
mov    -0x10(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    120b <output_cm_result+0xdb>
mov    -0x8(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b9 <output_cm_result+0x89>
mov    -0x10(%rbp),%rdi
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1206 <output_cm_result+0xd6>
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11ef <output_cm_result+0xbf>
mov    -0x10(%rbp),%rdi
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1201 <output_cm_result+0xd1>
mov    -0x10(%rbp),%rdi
lea    0xe3f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1206 <output_cm_result+0xd6>
jmp    120b <output_cm_result+0xdb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_cm_result>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeaf(%rip),%rsi
mov    %r14,%rdi
mov    $0x3b,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11aa <output_cm_result+0x6a>
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b3 <output_cm_result+0x73>
lea    0xea1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11d3 <output_cm_result+0x93>
lea    0xe91(%rip),%rdi
jmp    11ba <output_cm_result+0x7a>
lea    0xe57(%rip),%rdi
jmp    11ba <output_cm_result+0x7a>
lea    0xe64(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <fwrite@plt>
lea    0xe5a(%rip),%rdi
mov    $0x4,%esi
jmp    11bf <output_cm_result+0x7f>

LLVM IR (-O0):
@.str = [4 x i8] c"%c \00"
@.str.1 = [4 x i8] c"1-0\00"
@.str.2 = [18 x i8] c"and black resigns\00"
@.str.3 = [4 x i8] c"0-1\00"
@.str.4 = [18 x i8] c"and white resigns\00"
@.str.5 = [4 x i8] c"1/2\00"
@.str.6 = [5 x i8] c"draw\00"
@.str.7 = [18 x i8] c"incomplete result\00"
define void @output_cm_result(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 59)
%7 = load i8*, i8** %3
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32*, i32** %4
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %32
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32*, i32** %4
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %31
20: ; preds = %13
%21 = load i8*, i8** %3
%22 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i32*, i32** %4
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %30
27: ; preds = %20
%28 = load i32*, i32** %4
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %30
30: ; preds = %27, %24
br label %31
31: ; preds = %30, %17
br label %32
32: ; preds = %31, %10
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c \00"
@.str.1 = [4 x i8] c"1-0\00"
@.str.2 = [18 x i8] c"and black resigns\00"
@.str.3 = [4 x i8] c"0-1\00"
@.str.4 = [18 x i8] c"and white resigns\00"
@.str.5 = [4 x i8] c"1/2\00"
@.str.6 = [5 x i8] c"draw\00"
@.str.7 = [18 x i8] c"incomplete result\00"
define void @output_cm_result(i8* %0, i32* nocapture %1) {
%3 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 59)
%4 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 17, i64 1, i32* %1)
br label %20
8: ; preds = %2
%9 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i64 17, i64 1, i32* %1)
br label %20
13: ; preds = %8
%14 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 4, i64 1, i32* %1)
br label %20
18: ; preds = %13
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i64 17, i64 1, i32* %1)
br label %20
20: ; preds = %11, %18, %16, %6
ret void
}