#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*/ add(char, char, int /*<<< orphan*/);
char *get_string(char);
int /*<<< orphan*/ gettime();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ write();
void result(char p, char c) {
  add(p, c, gettime());
  write();
  printf("Computer played %s\n", get_string(c));
  if (p == c) {
    printf("It's a tie\n");
  } else if ((p == 'r' && c == 's') || (p == 'p' && c == 'r') ||
             (p == 's' && c == 'p')) {
    printf("You won\n");
  } else {
    printf("The computer won\n");
  }
}


x86 assembly (clang, -O0):
<result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x4(%rbp)
mov    -0x2(%rbp),%al
mov    %al,-0x3(%rbp)
mov    $0x0,%al
call   1070 <gettime@plt>
mov    -0x4(%rbp),%cl
mov    %eax,%edx
mov    -0x3(%rbp),%al
movsbl %cl,%edi
movsbl %al,%esi
call   1030 <add@plt>
mov    $0x0,%al
call   1040 <write@plt>
movsbl -0x2(%rbp),%edi
call   1050 <get_string@plt>
mov    %rax,%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
jne    11ce <result+0x7e>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1242 <result+0xf2>
movsbl -0x1(%rbp),%eax
cmp    $0x72,%eax
jne    11e8 <result+0x98>
movsbl -0x2(%rbp),%eax
cmp    $0x73,%eax
je     121c <result+0xcc>
movsbl -0x1(%rbp),%eax
cmp    $0x70,%eax
jne    1202 <result+0xb2>
movsbl -0x2(%rbp),%eax
cmp    $0x72,%eax
je     121c <result+0xcc>
movsbl -0x1(%rbp),%eax
cmp    $0x73,%eax
jne    122f <result+0xdf>
movsbl -0x2(%rbp),%eax
cmp    $0x70,%eax
jne    122f <result+0xdf>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    123d <result+0xed>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1242 <result+0xf2>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<result>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1080 <gettime@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <add@plt>
xor    %eax,%eax
call   1050 <write@plt>
mov    %ebx,%edi
call   1060 <get_string@plt>
lea    0xe72(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    %bl,%bpl
jne    11a6 <result+0x46>
lea    0xe89(%rip),%rdi
jmp    11df <result+0x7f>
lea    0xe78(%rip),%rdi
cmp    $0x72,%bpl
jne    11b8 <result+0x58>
cmp    $0x73,%bl
je     11df <result+0x7f>
cmp    $0x70,%bpl
jne    11c3 <result+0x63>
cmp    $0x72,%bl
je     11df <result+0x7f>
xor    $0x73,%bpl
xor    $0x70,%bl
lea    0xe54(%rip),%rax
lea    0xe3c(%rip),%rdi
or     %bpl,%bl
cmove  %rax,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Computer played %s\0A\00"
@.str.1 = [12 x i8] c"It's a tie\0A\00"
@.str.2 = [9 x i8] c"You won\0A\00"
@.str.3 = [18 x i8] c"The computer won\0A\00"
define void @result(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = load i8, i8* %4
%7 = call i32 (...) @gettime()
%8 = call i32 @add(i8 signext %5, i8 signext %6, i32 %7)
%9 = call i32 (...) @write()
%10 = load i8, i8* %4
%11 = call i8* @get_string(i8 signext %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %49
20: ; preds = %2
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 114
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i8, i8* %4
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 115
br i1 %27, label %44, label %28
28: ; preds = %24, %20
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 112
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i8, i8* %4
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 114
br i1 %35, label %44, label %36
36: ; preds = %32, %28
%37 = load i8, i8* %3
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 115
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load i8, i8* %4
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 112
br i1 %43, label %44, label %46
44: ; preds = %40, %32, %24
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %48
46: ; preds = %40, %36
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %48
48: ; preds = %46, %44
br label %49
49: ; preds = %48, %18
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Computer played %s\0A\00"
@str = [17 x i8] c"The computer won\00"
@str.4 = [8 x i8] c"You won\00"
@str.5 = [11 x i8] c"It's a tie\00"
define void @result(i8 signext %0, i8 signext %1) {
%3 = tail call i32 (...) @gettime()
%4 = tail call i32 @add(i8 signext %0, i8 signext %1, i32 %3)
%5 = tail call i32 (...) @write()
%6 = tail call i8* @get_string(i8 signext %1)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp eq i8 %0, %1
br i1 %8, label %22, label %9
9: ; preds = %2
%10 = icmp eq i8 %0, 114
%11 = icmp eq i8 %1, 115
%12 = and i1 %10, %11
br i1 %12, label %22, label %13
13: ; preds = %9
%14 = icmp eq i8 %0, 112
%15 = icmp eq i8 %1, 114
%16 = and i1 %14, %15
br i1 %16, label %22, label %17
17: ; preds = %13
%18 = icmp eq i8 %0, 115
%19 = icmp eq i8 %1, 112
%20 = and i1 %18, %19
%21 = select i1 %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0)
br label %22
22: ; preds = %17, %9, %13, %2
%23 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0), %2 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0), %13 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0), %9 ], [ %21, %17 ]
%24 = tail call i32 @puts(i8* dereferenceable(1) %23)
ret void
}