#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 */
char getchar();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int ifwin(int *f) {
  char a;
  for (int i = 0; i < 16; i++) {
    if (*(f + i) == 2048) {
      puts("You Got 2048,Do you want to continue?");
      while (1) {
        scanf("%c", &a);
        while (getchar() != '\n')
          continue;
        if (a != 'y' || a != 'n')
          puts("Please input y or n.");
        else
          break;
      }
      return (a = 'y') ? 0 : 1;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<ifwin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jge    11ee <ifwin+0xbe>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x800,(%rax,%rcx,4)
jne    11db <ifwin+0xab>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1196 <ifwin+0x66>
jmp    117e <ifwin+0x4e>
movsbl -0x11(%rbp),%eax
cmp    $0x79,%eax
jne    11b0 <ifwin+0x80>
movsbl -0x11(%rbp),%eax
cmp    $0x6e,%eax
je     11c1 <ifwin+0x91>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
jmp    11c6 <ifwin+0x96>
jmp    11cb <ifwin+0x9b>
jmp    116e <ifwin+0x3e>
movb   $0x79,-0x11(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    11f5 <ifwin+0xc5>
jmp    11e0 <ifwin+0xb0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1143 <ifwin+0x13>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifwin>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmpl   $0x800,(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x4(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x8(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0xc(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x10(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x14(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x18(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x1c(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x20(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x24(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x28(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x2c(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x30(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x34(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x38(%rdi)
je     11cc <ifwin+0x9c>
cmpl   $0x800,0x3c(%rdi)
jne    1215 <ifwin+0xe5>
lea    0xe2d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe47(%rip),%r14
lea    0xf(%rsp),%r15
lea    0xe3e(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1200 <ifwin+0xd0>
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    11f0 <ifwin+0xc0>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [38 x i8] c"You Got 2048,Do you want to continue?\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [21 x i8] c"Please input y or n.\00"
define i32 @ifwin(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i8
%5 = alloca i32
store i32* %0, i32** %3
store i32 0, i32* %5
br label %6
6: ; preds = %39, %1
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 16
br i1 %8, label %9, label %42
9: ; preds = %6
%10 = load i32*, i32** %3
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 2048
br i1 %15, label %16, label %38
16: ; preds = %9
%17 = call i32 @puts(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %36
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %20
20: ; preds = %24, %18
%21 = call signext i8 (...) @getchar()
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 10
br i1 %23, label %24, label %25
24: ; preds = %20
br label %20
25: ; preds = %20
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 121
br i1 %28, label %33, label %29
29: ; preds = %25
%30 = load i8, i8* %4
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 110
br i1 %32, label %33, label %35
33: ; preds = %29, %25
%34 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %36
35: ; preds = %29
br label %37
36: ; preds = %33
br label %18
37: ; preds = %35
store i8 121, i8* %4
store i32 0, i32* %2
br label %43
38: ; preds = %9
br label %39
39: ; preds = %38
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %6
42: ; preds = %6
store i32 -1, i32* %2
br label %43
43: ; preds = %42, %37
%44 = load i32, i32* %2
ret i32 %44
}

LLVM IR (-O2):
@.str = [38 x i8] c"You Got 2048,Do you want to continue?\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [21 x i8] c"Please input y or n.\00"
define i32 @ifwin(i32* nocapture %0) {
%2 = alloca i8
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, 2048
br i1 %4, label %66, label %5
5: ; preds = %1
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 2048
br i1 %8, label %66, label %9
9: ; preds = %5
%10 = getelementptr inbounds i32, i32* %0, i64 2
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 2048
br i1 %12, label %66, label %13
13: ; preds = %9
%14 = getelementptr inbounds i32, i32* %0, i64 3
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 2048
br i1 %16, label %66, label %17
17: ; preds = %13
%18 = getelementptr inbounds i32, i32* %0, i64 4
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 2048
br i1 %20, label %66, label %21
21: ; preds = %17
%22 = getelementptr inbounds i32, i32* %0, i64 5
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 2048
br i1 %24, label %66, label %25
25: ; preds = %21
%26 = getelementptr inbounds i32, i32* %0, i64 6
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 2048
br i1 %28, label %66, label %29
29: ; preds = %25
%30 = getelementptr inbounds i32, i32* %0, i64 7
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 2048
br i1 %32, label %66, label %33
33: ; preds = %29
%34 = getelementptr inbounds i32, i32* %0, i64 8
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, 2048
br i1 %36, label %66, label %37
37: ; preds = %33
%38 = getelementptr inbounds i32, i32* %0, i64 9
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, 2048
br i1 %40, label %66, label %41
41: ; preds = %37
%42 = getelementptr inbounds i32, i32* %0, i64 10
%43 = load i32, i32* %42
%44 = icmp eq i32 %43, 2048
br i1 %44, label %66, label %45
45: ; preds = %41
%46 = getelementptr inbounds i32, i32* %0, i64 11
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, 2048
br i1 %48, label %66, label %49
49: ; preds = %45
%50 = getelementptr inbounds i32, i32* %0, i64 12
%51 = load i32, i32* %50
%52 = icmp eq i32 %51, 2048
br i1 %52, label %66, label %53
53: ; preds = %49
%54 = getelementptr inbounds i32, i32* %0, i64 13
%55 = load i32, i32* %54
%56 = icmp eq i32 %55, 2048
br i1 %56, label %66, label %57
57: ; preds = %53
%58 = getelementptr inbounds i32, i32* %0, i64 14
%59 = load i32, i32* %58
%60 = icmp eq i32 %59, 2048
br i1 %60, label %66, label %61
61: ; preds = %57
%62 = getelementptr inbounds i32, i32* %0, i64 15
%63 = load i32, i32* %62
%64 = icmp eq i32 %63, 2048
br i1 %64, label %66, label %65
65: ; preds = %61
ret i32 -1
66: ; preds = %61, %57, %53, %49, %45, %41, %37, %33, %29, %25, %21, %17, %13, %9, %5, %1
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %68
68: ; preds = %73, %66
%69 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %70
70: ; preds = %70, %68
%71 = call signext i8 (...) @getchar()
%72 = icmp eq i8 %71, 10
br i1 %72, label %73, label %70
73: ; preds = %70
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %68
}