#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*/ printf(char *);
int setMap(char *map, int decision) {
  if (decision <= 0 || decision >= 10) {
    printf("Wert muss zwischen 1 und 9 sein.\n");
    return 1;
  }
  if (map[decision - 1] == 'X' || map[decision - 1] == 'Y') {
    printf("Platz schon mit einem X oder Y belegt!\n");
    return 2;
  }
  map[decision - 1] = 'X';
  return 0;
}


x86 assembly (clang, -O0):
<setMap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1133 <setMap+0x23>
cmpl   $0xa,-0x14(%rbp)
jl     114b <setMap+0x3b>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11af <setMap+0x9f>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x58,%eax
je     117f <setMap+0x6f>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x59,%eax
jne    1197 <setMap+0x87>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    11af <setMap+0x9f>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x58,(%rax,%rcx,1)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setMap>:
push   %rax
lea    -0xa(%rsi),%eax
cmp    $0xfffffff6,%eax
ja     112c <setMap+0x1c>
lea    0xf07(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret
add    $0xffffffff,%esi
mov    (%rdi,%rsi,1),%al
and    $0xfe,%al
cmp    $0x58,%al
jne    114b <setMap+0x3b>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%eax
pop    %rcx
ret
movb   $0x58,(%rdi,%rsi,1)
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Wert muss zwischen 1 und 9 sein.\0A\00"
@.str.1 = [40 x i8] c"Platz schon mit einem X oder Y belegt!\0A\00"
define i32 @setMap(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sle i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sge i32 %9, 10
br i1 %10, label %11, label %13
11: ; preds = %8, %2
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %39
13: ; preds = %8
%14 = load i8*, i8** %4
%15 = load i32, i32* %5
%16 = sub nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %14, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 88
br i1 %21, label %31, label %22
22: ; preds = %13
%23 = load i8*, i8** %4
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %23, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 89
br i1 %30, label %31, label %33
31: ; preds = %22, %13
%32 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %3
br label %39
33: ; preds = %22
%34 = load i8*, i8** %4
%35 = load i32, i32* %5
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %34, i64 %37
store i8 88, i8* %38
store i32 0, i32* %3
br label %39
39: ; preds = %33, %31, %11
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@str = [39 x i8] c"Platz schon mit einem X oder Y belegt!\00"
@str.2 = [33 x i8] c"Wert muss zwischen 1 und 9 sein.\00"
define i32 @setMap(i8* nocapture %0, i32 %1) {
%3 = add i32 %1, -10
%4 = icmp ult i32 %3, -9
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.2, i64 0, i64 0))
br label %17
7: ; preds = %2
%8 = add nsw i32 %1, -1
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = and i8 %11, -2
%13 = icmp eq i8 %12, 88
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %17
16: ; preds = %7
store i8 88, i8* %10
br label %17
17: ; preds = %16, %14, %5
%18 = phi i32 [ 1, %5 ], [ 2, %14 ], [ 0, %16 ]
ret i32 %18
}