#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*/ compareNum(int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ setRandNum(int *);
int /*<<< orphan*/ userNumInput(int *);
int main(void) {
  int comNum[3] = {0};
  int userNum[3] = {0};
  int strikeResult = 0;
  int ballReslut = 0;
  int gameCount = 0;
  setRandNum(comNum);
  while (strikeResult != 3) {
    gameCount++;
    userNumInput(userNum);
    compareNum(comNum, userNum, &strikeResult, &ballReslut);
    printf("The result: %d strike, %d ball\n\n", strikeResult, ballReslut);
  }
  printf("Finally you hit in %d times!\n", gameCount);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
lea    -0x1c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0x10(%rbp),%rdi
call   1070 <setRandNum@plt>
cmpl   $0x3,-0x20(%rbp)
je     11e7 <main+0x97>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
lea    -0x1c(%rbp),%rdi
call   1060 <userNumInput@plt>
lea    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1050 <compareNum@plt>
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119d <main+0x4d>
mov    -0x28(%rbp),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
lea    0x18(%rsp),%r14
mov    %r14,%rdi
call   1060 <setRandNum@plt>
lea    0x8(%rsp),%rbx
mov    %rsp,%r15
lea    0x4(%rsp),%r12
lea    0xe60(%rip),%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
mov    %rbx,%rdi
call   1050 <userNumInput@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <compareNum@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x3,(%rsp)
jne    11b0 <main+0x70>
lea    0xe37(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"The result: %d strike, %d ball\0A\0A\00"
@.str.1 = [30 x i8] c"Finally you hit in %d times!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca [3 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [3 x i32]* %2 to i8*
%8 = bitcast [3 x i32]* %3 to i8*
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%10 = call i32 @setRandNum(i32* %9)
br label %11
11: ; preds = %14, %0
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
store i32 %16, i32* %6
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%18 = call i32 @userNumInput(i32* %17)
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%21 = call i32 @compareNum(i32* %19, i32* %20, i32* %4, i32* %5)
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23)
br label %11
25: ; preds = %11
%26 = load i32, i32* %6
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"The result: %d strike, %d ball\0A\0A\00"
@.str.1 = [30 x i8] c"Finally you hit in %d times!\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [3 x i32]* %1 to i8*
%6 = bitcast [3 x i32]* %2 to i8*
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%10 = call i32 @setRandNum(i32* %9)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
br label %12
12: ; preds = %0, %12
%13 = phi i32 [ 0, %0 ], [ %14, %12 ]
%14 = add nuw nsw i32 %13, 1
%15 = call i32 @userNumInput(i32* %11)
%16 = call i32 @compareNum(i32* %9, i32* %11, i32* %3, i32* %4)
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 3
br i1 %21, label %22, label %12
22: ; preds = %12
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret i32 0
}