#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 /*<<< orphan*/ *strstr(char *, char *);
int parse_field(char *bufor, int *x, int *y) {
  *x = bufor[1] - 48;
  if (!(*x < 10 && *x >= 0)) {
    printf("Bledne pole - podaj od A0 do J9.\n");
    return 0;
  }
  if (strstr(bufor, "A") != NULL) {
    *y = 0;
  } else if (strstr(bufor, "B") != NULL) {
    *y = 1;
  } else if (strstr(bufor, "C") != NULL) {
    *y = 2;
  } else if (strstr(bufor, "D") != NULL) {
    *y = 3;
  } else if (strstr(bufor, "E") != NULL) {
    *y = 4;
  } else if (strstr(bufor, "F") != NULL) {
    *y = 5;
  } else if (strstr(bufor, "G") != NULL) {
    *y = 6;
  } else if (strstr(bufor, "H") != NULL) {
    *y = 7;
  } else if (strstr(bufor, "I") != NULL) {
    *y = 8;
  } else if (strstr(bufor, "J") != NULL) {
    *y = 9;
  } else {
    printf("Bledne pole - podaj od A0 do J9.\n");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<parse_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%ecx
sub    $0x30,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0xa,(%rax)
jge    115f <parse_field+0x3f>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jge    1177 <parse_field+0x57>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    135d <parse_field+0x23d>
mov    -0x10(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     11a0 <parse_field+0x80>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
jmp    1356 <parse_field+0x236>
mov    -0x10(%rbp),%rdi
lea    0xe79(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     11c9 <parse_field+0xa9>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
jmp    1351 <parse_field+0x231>
mov    -0x10(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     11f2 <parse_field+0xd2>
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
jmp    134c <parse_field+0x22c>
mov    -0x10(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     121b <parse_field+0xfb>
mov    -0x20(%rbp),%rax
movl   $0x3,(%rax)
jmp    1347 <parse_field+0x227>
mov    -0x10(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     1244 <parse_field+0x124>
mov    -0x20(%rbp),%rax
movl   $0x4,(%rax)
jmp    1342 <parse_field+0x222>
mov    -0x10(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     126d <parse_field+0x14d>
mov    -0x20(%rbp),%rax
movl   $0x5,(%rax)
jmp    133d <parse_field+0x21d>
mov    -0x10(%rbp),%rdi
lea    0xdb6(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     1296 <parse_field+0x176>
mov    -0x20(%rbp),%rax
movl   $0x6,(%rax)
jmp    1338 <parse_field+0x218>
mov    -0x10(%rbp),%rdi
lea    0xd8f(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     12bf <parse_field+0x19f>
mov    -0x20(%rbp),%rax
movl   $0x7,(%rax)
jmp    1333 <parse_field+0x213>
mov    -0x10(%rbp),%rdi
lea    0xd68(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     12e8 <parse_field+0x1c8>
mov    -0x20(%rbp),%rax
movl   $0x8,(%rax)
jmp    132e <parse_field+0x20e>
mov    -0x10(%rbp),%rdi
lea    0xd41(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     1311 <parse_field+0x1f1>
mov    -0x20(%rbp),%rax
movl   $0x9,(%rax)
jmp    1329 <parse_field+0x209>
lea    0xce8(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    135d <parse_field+0x23d>
jmp    132e <parse_field+0x20e>
jmp    1333 <parse_field+0x213>
jmp    1338 <parse_field+0x218>
jmp    133d <parse_field+0x21d>
jmp    1342 <parse_field+0x222>
jmp    1347 <parse_field+0x227>
jmp    134c <parse_field+0x22c>
jmp    1351 <parse_field+0x231>
jmp    1356 <parse_field+0x236>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_field>:
push   %r14
push   %rbx
push   %rax
movsbl 0x1(%rdi),%eax
lea    -0x30(%rax),%ecx
add    $0xffffffd0,%eax
mov    %eax,(%rsi)
cmp    $0xa,%cl
jae    128e <parse_field+0x16e>
mov    %rdx,%r14
mov    %rdi,%rbx
mov    $0x41,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     115f <parse_field+0x3f>
movl   $0x0,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
mov    %rbx,%rdi
mov    $0x42,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1182 <parse_field+0x62>
movl   $0x1,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
mov    %rbx,%rdi
mov    $0x43,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11a5 <parse_field+0x85>
movl   $0x2,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
mov    %rbx,%rdi
mov    $0x44,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11c8 <parse_field+0xa8>
movl   $0x3,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
mov    %rbx,%rdi
mov    $0x45,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11eb <parse_field+0xcb>
movl   $0x4,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
mov    %rbx,%rdi
mov    $0x46,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     120e <parse_field+0xee>
movl   $0x5,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
mov    %rbx,%rdi
mov    $0x47,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     122e <parse_field+0x10e>
movl   $0x6,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
mov    %rbx,%rdi
mov    $0x48,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     124e <parse_field+0x12e>
movl   $0x7,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
mov    %rbx,%rdi
mov    $0x49,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     126e <parse_field+0x14e>
movl   $0x8,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
mov    %rbx,%rdi
mov    $0x4a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     128e <parse_field+0x16e>
movl   $0x9,(%r14)
mov    $0x1,%eax
jmp    129c <parse_field+0x17c>
lea    0xd6b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Bledne pole - podaj od A0 do J9.\0A\00"
@.str.1 = [2 x i8] c"A\00"
@.str.2 = [2 x i8] c"B\00"
@.str.3 = [2 x i8] c"C\00"
@.str.4 = [2 x i8] c"D\00"
@.str.5 = [2 x i8] c"E\00"
@.str.6 = [2 x i8] c"F\00"
@.str.7 = [2 x i8] c"G\00"
@.str.8 = [2 x i8] c"H\00"
@.str.9 = [2 x i8] c"I\00"
@.str.10 = [2 x i8] c"J\00"
define i32 @parse_field(i8* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %11, 48
%13 = load i32*, i32** %6
store i32 %12, i32* %13
%14 = load i32*, i32** %6
%15 = load i32, i32* %14
%16 = icmp slt i32 %15, 10
br i1 %16, label %17, label %21
17: ; preds = %3
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = icmp sge i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %17, %3
%22 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %95
23: ; preds = %17
%24 = load i8*, i8** %5
%25 = call i32* @strstr(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load i32*, i32** %7
store i32 0, i32* %28
br label %94
29: ; preds = %23
%30 = load i8*, i8** %5
%31 = call i32* @strstr(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp ne i32* %31, null
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = load i32*, i32** %7
store i32 1, i32* %34
br label %93
35: ; preds = %29
%36 = load i8*, i8** %5
%37 = call i32* @strstr(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp ne i32* %37, null
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = load i32*, i32** %7
store i32 2, i32* %40
br label %92
41: ; preds = %35
%42 = load i8*, i8** %5
%43 = call i32* @strstr(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%44 = icmp ne i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = load i32*, i32** %7
store i32 3, i32* %46
br label %91
47: ; preds = %41
%48 = load i8*, i8** %5
%49 = call i32* @strstr(i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%50 = icmp ne i32* %49, null
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = load i32*, i32** %7
store i32 4, i32* %52
br label %90
53: ; preds = %47
%54 = load i8*, i8** %5
%55 = call i32* @strstr(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%56 = icmp ne i32* %55, null
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = load i32*, i32** %7
store i32 5, i32* %58
br label %89
59: ; preds = %53
%60 = load i8*, i8** %5
%61 = call i32* @strstr(i8* %60, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%62 = icmp ne i32* %61, null
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = load i32*, i32** %7
store i32 6, i32* %64
br label %88
65: ; preds = %59
%66 = load i8*, i8** %5
%67 = call i32* @strstr(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%68 = icmp ne i32* %67, null
br i1 %68, label %69, label %71
69: ; preds = %65
%70 = load i32*, i32** %7
store i32 7, i32* %70
br label %87
71: ; preds = %65
%72 = load i8*, i8** %5
%73 = call i32* @strstr(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%74 = icmp ne i32* %73, null
br i1 %74, label %75, label %77
75: ; preds = %71
%76 = load i32*, i32** %7
store i32 8, i32* %76
br label %86
77: ; preds = %71
%78 = load i8*, i8** %5
%79 = call i32* @strstr(i8* %78, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%80 = icmp ne i32* %79, null
br i1 %80, label %81, label %83
81: ; preds = %77
%82 = load i32*, i32** %7
store i32 9, i32* %82
br label %85
83: ; preds = %77
%84 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %95
85: ; preds = %81
br label %86
86: ; preds = %85, %75
br label %87
87: ; preds = %86, %69
br label %88
88: ; preds = %87, %63
br label %89
89: ; preds = %88, %57
br label %90
90: ; preds = %89, %51
br label %91
91: ; preds = %90, %45
br label %92
92: ; preds = %91, %39
br label %93
93: ; preds = %92, %33
br label %94
94: ; preds = %93, %27
store i32 1, i32* %4
br label %95
95: ; preds = %94, %83, %21
%96 = load i32, i32* %4
ret i32 %96
}

LLVM IR (-O2):
@str.11 = [33 x i8] c"Bledne pole - podaj od A0 do J9.\00"
define i32 @parse_field(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = add nsw i32 %6, -48
store i32 %7, i32* %1
%8 = add i8 %5, -48
%9 = icmp ult i8 %8, 10
br i1 %9, label %12, label %10
10: ; preds = %3
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.11, i64 0, i64 0))
br label %54
12: ; preds = %3
%13 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 65)
%14 = icmp eq i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %12
store i32 0, i32* %2
br label %54
16: ; preds = %12
%17 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 66)
%18 = icmp eq i8* %17, null
br i1 %18, label %20, label %19
19: ; preds = %16
store i32 1, i32* %2
br label %54
20: ; preds = %16
%21 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 67)
%22 = icmp eq i8* %21, null
br i1 %22, label %24, label %23
23: ; preds = %20
store i32 2, i32* %2
br label %54
24: ; preds = %20
%25 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 68)
%26 = icmp eq i8* %25, null
br i1 %26, label %28, label %27
27: ; preds = %24
store i32 3, i32* %2
br label %54
28: ; preds = %24
%29 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 69)
%30 = icmp eq i8* %29, null
br i1 %30, label %32, label %31
31: ; preds = %28
store i32 4, i32* %2
br label %54
32: ; preds = %28
%33 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 70)
%34 = icmp eq i8* %33, null
br i1 %34, label %36, label %35
35: ; preds = %32
store i32 5, i32* %2
br label %54
36: ; preds = %32
%37 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 71)
%38 = icmp eq i8* %37, null
br i1 %38, label %40, label %39
39: ; preds = %36
store i32 6, i32* %2
br label %54
40: ; preds = %36
%41 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 72)
%42 = icmp eq i8* %41, null
br i1 %42, label %44, label %43
43: ; preds = %40
store i32 7, i32* %2
br label %54
44: ; preds = %40
%45 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 73)
%46 = icmp eq i8* %45, null
br i1 %46, label %48, label %47
47: ; preds = %44
store i32 8, i32* %2
br label %54
48: ; preds = %44
%49 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 74)
%50 = icmp eq i8* %49, null
br i1 %50, label %52, label %51
51: ; preds = %48
store i32 9, i32* %2
br label %54
52: ; preds = %48
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.11, i64 0, i64 0))
br label %54
54: ; preds = %15, %23, %31, %39, %47, %51, %43, %35, %27, %19, %52, %10
%55 = phi i32 [ 0, %52 ], [ 0, %10 ], [ 1, %19 ], [ 1, %27 ], [ 1, %35 ], [ 1, %43 ], [ 1, %51 ], [ 1, %47 ], [ 1, %39 ], [ 1, %31 ], [ 1, %23 ], [ 1, %15 ]
ret i32 %55
}