#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*/ bzero(char *, int);
char *calloc(int, int);
char *get_value(char *, char);
char *strcat(char *, char *);
int strlen(char *);
char *writeback(char *line, char *params, char *match) {
  char *buffer = calloc(500, sizeof(char));
  int i = 0;
  char *str2;
  int counter = 0;
  if (line == NULL) {
    if (params[6] == 'l') {
      str2 = "Chyba: neznamy login ";
    }
    if (params[6] == 'u') {
      str2 = "Chyba: nezname UID ";
    }
    strcat(buffer, str2);
    strcat(buffer, match);
    strcat(buffer, "\n");
    return buffer;
  }
  line[strlen(line)] = ':';
  int x = 1;
  int oddelovace[10];
  oddelovace[0] = 0;
  int f = 0;
  for (f = 0; i < strlen(line); i++) {
    if (line[i] == ':')
      counter++;
    if (counter % 7 == 0 && counter != 0) {
      counter = 0;
      oddelovace[x++] = i + 1;
    }
  }
  char templine[1000];
  bzero(templine, 1000);
  int j;
  x--;
  for (j = 0; j < x; j++) {
    int y;
    int z = 0;
    for (y = oddelovace[j]; y < (oddelovace[j + 1]); y++) {
      templine[z++] = line[y];
    }
    i = 0;
    while (params[i] != '_' && i < 6) {
      switch (params[i]) {
      case 'U':
        buffer = strcat(buffer, get_value(templine, 'U'));
        buffer = strcat(buffer, " ");
        break;
      case 'L':
        buffer = strcat(buffer, get_value(templine, 'L'));
        buffer = strcat(buffer, " ");
        break;
      case 'G':
        buffer = strcat(buffer, get_value(templine, 'G'));
        buffer = strcat(buffer, " ");
        break;
      case 'N':
        buffer = strcat(buffer, get_value(templine, 'N'));
        buffer = strcat(buffer, " ");
        break;
      case 'H':
        buffer = strcat(buffer, get_value(templine, 'H'));
        buffer = strcat(buffer, " ");
        break;
      case 'S':
        buffer = strcat(buffer, get_value(templine, 'S'));
        buffer = strcat(buffer, " ");
        if (buffer[strlen(buffer) - 1] == '\n') {
          buffer[strlen(buffer) - 1] = '\0';
        }
        break;
      }
      i++;
    }
    buffer[strlen(buffer) - 1] = '\n';
  }
  return buffer;
}


x86 assembly (clang, -O0):
<writeback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4d0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    $0x1f4,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1202 <writeback+0xb2>
mov    -0x18(%rbp),%rax
movsbl 0x6(%rax),%eax
cmp    $0x6c,%eax
jne    11af <writeback+0x5f>
lea    0xe91(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsbl 0x6(%rax),%eax
cmp    $0x75,%eax
jne    11cb <writeback+0x7b>
lea    0xe8b(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    164b <writeback+0x4fb>
mov    -0x10(%rbp),%rax
mov    %rax,-0x478(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x478(%rbp),%rax
movslq %ecx,%rcx
movb   $0x3a,(%rax,%rcx,1)
movl   $0x1,-0x40(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x47c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x47c(%rbp),%eax
cmp    %ecx,%eax
jge    12d1 <writeback+0x181>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
jne    1282 <writeback+0x132>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12be <writeback+0x16e>
cmpl   $0x0,-0x3c(%rbp)
je     12be <writeback+0x16e>
movl   $0x0,-0x3c(%rbp)
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x40(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x40(%rbp)
cltq
mov    %ecx,-0x70(%rbp,%rax,4)
jmp    12c3 <writeback+0x173>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1242 <writeback+0xf2>
lea    -0x460(%rbp),%rdi
mov    $0x3e8,%esi
call   1060 <bzero@plt>
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x464(%rbp)
mov    -0x464(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1643 <writeback+0x4f3>
movl   $0x0,-0x46c(%rbp)
movslq -0x464(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%eax
mov    %eax,-0x468(%rbp)
mov    -0x468(%rbp),%eax
mov    -0x464(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
jge    1377 <writeback+0x227>
mov    -0x10(%rbp),%rax
movslq -0x468(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x46c(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x46c(%rbp)
cltq
mov    %cl,-0x460(%rbp,%rax,1)
mov    -0x468(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x468(%rbp)
jmp    131f <writeback+0x1cf>
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x5f,%ecx
mov    %al,-0x47d(%rbp)
je     13a8 <writeback+0x258>
cmpl   $0x6,-0x2c(%rbp)
setl   %al
mov    %al,-0x47d(%rbp)
mov    -0x47d(%rbp),%al
test   $0x1,%al
jne    13bb <writeback+0x26b>
jmp    1608 <writeback+0x4b8>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0xffffffb9,%eax
mov    %eax,%ecx
mov    %rcx,-0x488(%rbp)
sub    $0xe,%eax
ja     15fa <writeback+0x4aa>
mov    -0x488(%rbp),%rax
lea    0xc16(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x28(%rbp),%rax
mov    %rax,-0x490(%rbp)
lea    -0x460(%rbp),%rdi
mov    $0x55,%esi
call   1050 <get_value@plt>
mov    -0x490(%rbp),%rdi
mov    %rax,%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xc37(%rip),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
jmp    15fa <writeback+0x4aa>
mov    -0x28(%rbp),%rax
mov    %rax,-0x498(%rbp)
lea    -0x460(%rbp),%rdi
mov    $0x4c,%esi
call   1050 <get_value@plt>
mov    -0x498(%rbp),%rdi
mov    %rax,%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xbef(%rip),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
jmp    15fa <writeback+0x4aa>
mov    -0x28(%rbp),%rax
mov    %rax,-0x4a0(%rbp)
lea    -0x460(%rbp),%rdi
mov    $0x47,%esi
call   1050 <get_value@plt>
mov    -0x4a0(%rbp),%rdi
mov    %rax,%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xba7(%rip),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
jmp    15fa <writeback+0x4aa>
mov    -0x28(%rbp),%rax
mov    %rax,-0x4a8(%rbp)
lea    -0x460(%rbp),%rdi
mov    $0x4e,%esi
call   1050 <get_value@plt>
mov    -0x4a8(%rbp),%rdi
mov    %rax,%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xb5f(%rip),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
jmp    15fa <writeback+0x4aa>
mov    -0x28(%rbp),%rax
mov    %rax,-0x4b0(%rbp)
lea    -0x460(%rbp),%rdi
mov    $0x48,%esi
call   1050 <get_value@plt>
mov    -0x4b0(%rbp),%rdi
mov    %rax,%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xb17(%rip),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
jmp    15fa <writeback+0x4aa>
mov    -0x28(%rbp),%rax
mov    %rax,-0x4c0(%rbp)
lea    -0x460(%rbp),%rdi
mov    $0x53,%esi
call   1050 <get_value@plt>
mov    -0x4c0(%rbp),%rdi
mov    %rax,%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xacf(%rip),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x4b8(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x4b8(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    15f5 <writeback+0x4a5>
mov    -0x28(%rbp),%rax
mov    %rax,-0x4c8(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x4c8(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    15fa <writeback+0x4aa>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    137e <writeback+0x22e>
mov    -0x28(%rbp),%rax
mov    %rax,-0x4d0(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x4d0(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0xa,(%rax,%rcx,1)
mov    -0x464(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x464(%rbp)
jmp    12f5 <writeback+0x1a5>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeback>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r13
mov    $0x1f4,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %r13,%r13
je     1237 <writeback+0xd7>
mov    %r13,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x3a,0x0(%r13,%rax,1)
movl   $0x0,0x20(%rsp)
mov    %r13,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    13f2 <writeback+0x292>
xor    %r15d,%r15d
mov    $0x1,%r12d
xor    %ebp,%ebp
jmp    11e3 <writeback+0x83>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%r15
jge    1274 <writeback+0x114>
mov    %ebp,%ecx
mov    %r15,%rax
xor    %ebp,%ebp
cmpb   $0x3a,0x0(%r13,%r15,1)
sete   %bpl
add    %ecx,%ebp
add    $0x1,%r15
test   %ebp,%ebp
je     11d0 <writeback+0x70>
movslq %ebp,%rcx
imul   $0xffffffff92492493,%rcx,%rcx
shr    $0x20,%rcx
add    %ebp,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %ebp,%ecx
jne    11d0 <writeback+0x70>
movslq %r12d,%rcx
add    $0x1,%r12d
add    $0x1,%eax
mov    %eax,0x20(%rsp,%rcx,4)
xor    %ebp,%ebp
jmp    11d0 <writeback+0x70>
cmpb   $0x75,0x6(%r14)
lea    0xe0f(%rip),%rax
lea    0xdf2(%rip),%rsi
cmove  %rax,%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0xa,(%rbx,%rax,1)
jmp    1401 <writeback+0x2a1>
mov    %r13,0x18(%rsp)
lea    0x50(%rsp),%rdi
mov    $0x3e8,%esi
call   1070 <bzero@plt>
mov    %r12,0x8(%rsp)
cmp    $0x2,%r12d
jl     1401 <writeback+0x2a1>
mov    0x8(%rsp),%rax
add    $0xffffffff,%eax
mov    %rax,0x8(%rsp)
mov    0x20(%rsp),%eax
xor    %r13d,%r13d
lea    0x50(%rsp),%r12
lea    0xd49(%rip),%r15
jmp    12de <writeback+0x17e>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0xa,-0x1(%rax,%rbx,1)
cmp    0x8(%rsp),%r13
mov    0x14(%rsp),%eax
je     1401 <writeback+0x2a1>
mov    0x24(%rsp,%r13,4),%ebp
cmp    %ebp,%eax
jge    1301 <writeback+0x1a1>
mov    %eax,%edx
movslq %eax,%rsi
add    0x18(%rsp),%rsi
not    %edx
add    %ebp,%edx
add    $0x1,%rdx
mov    %r12,%rdi
call   1050 <memcpy@plt>
mov    %ebp,0x14(%rsp)
add    $0x1,%r13
mov    (%r14),%al
cmp    $0x5f,%al
je     12c0 <writeback+0x160>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%eax
add    $0xffffffb9,%eax
cmp    $0xe,%eax
ja     13ce <writeback+0x26e>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    %r12,%rdi
mov    $0x47,%esi
jmp    13b0 <writeback+0x250>
mov    %r12,%rdi
mov    $0x48,%esi
jmp    13b0 <writeback+0x250>
mov    %r12,%rdi
mov    $0x4c,%esi
jmp    13b0 <writeback+0x250>
mov    %r12,%rdi
mov    $0x4e,%esi
jmp    13b0 <writeback+0x250>
mov    %r12,%rdi
mov    $0x53,%esi
call   1060 <get_value@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x20,(%rbx,%rax,1)
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    13ce <writeback+0x26e>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
jmp    13ce <writeback+0x26e>
mov    %r12,%rdi
mov    $0x55,%esi
call   1060 <get_value@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x20,(%rbx,%rax,1)
movzbl 0x1(%r14,%rbp,1),%eax
cmp    $0x5f,%al
je     12c0 <writeback+0x160>
lea    0x1(%rbp),%rcx
cmp    $0x5,%rbp
mov    %rcx,%rbp
jb     1320 <writeback+0x1c0>
jmp    12c0 <writeback+0x160>
lea    0x50(%rsp),%rdi
mov    $0x3e8,%esi
call   1070 <bzero@plt>
mov    %rbx,%rax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Chyba: neznamy login \00"
@.str.1 = [20 x i8] c"Chyba: nezname UID \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [2 x i8] c" \00"
define i8* @writeback(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca [10 x i32]
%14 = alloca i32
%15 = alloca [1000 x i8]
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%19 = call i8* @calloc(i32 500, i32 1)
store i8* %19, i8** %8
store i32 0, i32* %9
store i32 0, i32* %11
%20 = load i8*, i8** %5
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %46
22: ; preds = %3
%23 = load i8*, i8** %6
%24 = getelementptr inbounds i8, i8* %23, i64 6
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 108
br i1 %27, label %28, label %29
28: ; preds = %22
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8** %10
br label %29
29: ; preds = %28, %22
%30 = load i8*, i8** %6
%31 = getelementptr inbounds i8, i8* %30, i64 6
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 117
br i1 %34, label %35, label %36
35: ; preds = %29
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8** %10
br label %36
36: ; preds = %35, %29
%37 = load i8*, i8** %8
%38 = load i8*, i8** %10
%39 = call i8* @strcat(i8* %37, i8* %38)
%40 = load i8*, i8** %8
%41 = load i8*, i8** %7
%42 = call i8* @strcat(i8* %40, i8* %41)
%43 = load i8*, i8** %8
%44 = call i8* @strcat(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%45 = load i8*, i8** %8
store i8* %45, i8** %4
br label %217
46: ; preds = %3
%47 = load i8*, i8** %5
%48 = load i8*, i8** %5
%49 = call i32 @strlen(i8* %48)
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %47, i64 %50
store i8 58, i8* %51
store i32 1, i32* %12
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i64 0, i64 0
store i32 0, i32* %52
store i32 0, i32* %14
store i32 0, i32* %14
br label %53
53: ; preds = %84, %46
%54 = load i32, i32* %9
%55 = load i8*, i8** %5
%56 = call i32 @strlen(i8* %55)
%57 = icmp slt i32 %54, %56
br i1 %57, label %58, label %87
58: ; preds = %53
%59 = load i8*, i8** %5
%60 = load i32, i32* %9
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 58
br i1 %65, label %66, label %69
66: ; preds = %58
%67 = load i32, i32* %11
%68 = add nsw i32 %67, 1
store i32 %68, i32* %11
br label %69
69: ; preds = %66, %58
%70 = load i32, i32* %11
%71 = srem i32 %70, 7
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %83
73: ; preds = %69
%74 = load i32, i32* %11
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %83
76: ; preds = %73
store i32 0, i32* %11
%77 = load i32, i32* %9
%78 = add nsw i32 %77, 1
%79 = load i32, i32* %12
%80 = add nsw i32 %79, 1
store i32 %80, i32* %12
%81 = sext i32 %79 to i64
%82 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i64 0, i64 %81
store i32 %78, i32* %82
br label %83
83: ; preds = %76, %73, %69
br label %84
84: ; preds = %83
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 1
store i32 %86, i32* %9
br label %53
87: ; preds = %53
%88 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%89 = call i32 @bzero(i8* %88, i32 1000)
%90 = load i32, i32* %12
%91 = add nsw i32 %90, -1
store i32 %91, i32* %12
store i32 0, i32* %16
br label %92
92: ; preds = %212, %87
%93 = load i32, i32* %16
%94 = load i32, i32* %12
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %215
96: ; preds = %92
store i32 0, i32* %18
%97 = load i32, i32* %16
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i64 0, i64 %98
%100 = load i32, i32* %99
store i32 %100, i32* %17
br label %101
101: ; preds = %119, %96
%102 = load i32, i32* %17
%103 = load i32, i32* %16
%104 = add nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i64 0, i64 %105
%107 = load i32, i32* %106
%108 = icmp slt i32 %102, %107
br i1 %108, label %109, label %122
109: ; preds = %101
%110 = load i8*, i8** %5
%111 = load i32, i32* %17
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* %110, i64 %112
%114 = load i8, i8* %113
%115 = load i32, i32* %18
%116 = add nsw i32 %115, 1
store i32 %116, i32* %18
%117 = sext i32 %115 to i64
%118 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 %117
store i8 %114, i8* %118
br label %119
119: ; preds = %109
%120 = load i32, i32* %17
%121 = add nsw i32 %120, 1
store i32 %121, i32* %17
br label %101
122: ; preds = %101
store i32 0, i32* %9
br label %123
123: ; preds = %202, %122
%124 = load i8*, i8** %6
%125 = load i32, i32* %9
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8, i8* %124, i64 %126
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = icmp ne i32 %129, 95
br i1 %130, label %131, label %134
131: ; preds = %123
%132 = load i32, i32* %9
%133 = icmp slt i32 %132, 6
br label %134
134: ; preds = %131, %123
%135 = phi i1 [ false, %123 ], [ %133, %131 ]
br i1 %135, label %136, label %205
136: ; preds = %134
%137 = load i8*, i8** %6
%138 = load i32, i32* %9
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i8, i8* %137, i64 %139
%141 = load i8, i8* %140
%142 = sext i8 %141 to i32
switch i32 %142, label %202 [
i32 85, label %143
i32 76, label %150
i32 71, label %157
i32 78, label %164
i32 72, label %171
i32 83, label %178
]
143: ; preds = %136
%144 = load i8*, i8** %8
%145 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%146 = call i8* @get_value(i8* %145, i8 signext 85)
%147 = call i8* @strcat(i8* %144, i8* %146)
store i8* %147, i8** %8
%148 = load i8*, i8** %8
%149 = call i8* @strcat(i8* %148, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %149, i8** %8
br label %202
150: ; preds = %136
%151 = load i8*, i8** %8
%152 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%153 = call i8* @get_value(i8* %152, i8 signext 76)
%154 = call i8* @strcat(i8* %151, i8* %153)
store i8* %154, i8** %8
%155 = load i8*, i8** %8
%156 = call i8* @strcat(i8* %155, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %156, i8** %8
br label %202
157: ; preds = %136
%158 = load i8*, i8** %8
%159 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%160 = call i8* @get_value(i8* %159, i8 signext 71)
%161 = call i8* @strcat(i8* %158, i8* %160)
store i8* %161, i8** %8
%162 = load i8*, i8** %8
%163 = call i8* @strcat(i8* %162, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %163, i8** %8
br label %202
164: ; preds = %136
%165 = load i8*, i8** %8
%166 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%167 = call i8* @get_value(i8* %166, i8 signext 78)
%168 = call i8* @strcat(i8* %165, i8* %167)
store i8* %168, i8** %8
%169 = load i8*, i8** %8
%170 = call i8* @strcat(i8* %169, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %170, i8** %8
br label %202
171: ; preds = %136
%172 = load i8*, i8** %8
%173 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%174 = call i8* @get_value(i8* %173, i8 signext 72)
%175 = call i8* @strcat(i8* %172, i8* %174)
store i8* %175, i8** %8
%176 = load i8*, i8** %8
%177 = call i8* @strcat(i8* %176, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %177, i8** %8
br label %202
178: ; preds = %136
%179 = load i8*, i8** %8
%180 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%181 = call i8* @get_value(i8* %180, i8 signext 83)
%182 = call i8* @strcat(i8* %179, i8* %181)
store i8* %182, i8** %8
%183 = load i8*, i8** %8
%184 = call i8* @strcat(i8* %183, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %184, i8** %8
%185 = load i8*, i8** %8
%186 = load i8*, i8** %8
%187 = call i32 @strlen(i8* %186)
%188 = sub nsw i32 %187, 1
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds i8, i8* %185, i64 %189
%191 = load i8, i8* %190
%192 = sext i8 %191 to i32
%193 = icmp eq i32 %192, 10
br i1 %193, label %194, label %201
194: ; preds = %178
%195 = load i8*, i8** %8
%196 = load i8*, i8** %8
%197 = call i32 @strlen(i8* %196)
%198 = sub nsw i32 %197, 1
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds i8, i8* %195, i64 %199
store i8 0, i8* %200
br label %201
201: ; preds = %194, %178
br label %202
202: ; preds = %136, %201, %171, %164, %157, %150, %143
%203 = load i32, i32* %9
%204 = add nsw i32 %203, 1
store i32 %204, i32* %9
br label %123
205: ; preds = %134
%206 = load i8*, i8** %8
%207 = load i8*, i8** %8
%208 = call i32 @strlen(i8* %207)
%209 = sub nsw i32 %208, 1
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i8, i8* %206, i64 %210
store i8 10, i8* %211
br label %212
212: ; preds = %205
%213 = load i32, i32* %16
%214 = add nsw i32 %213, 1
store i32 %214, i32* %16
br label %92
215: ; preds = %92
%216 = load i8*, i8** %8
store i8* %216, i8** %4
br label %217
217: ; preds = %215, %36
%218 = load i8*, i8** %4
ret i8* %218
}

LLVM IR (-O2):
@.str = [22 x i8] c"Chyba: neznamy login \00"
@.str.1 = [20 x i8] c"Chyba: nezname UID \00"
define i8* @writeback(i8* %0, i8* nocapture %1, i8* nocapture %2) {
%4 = alloca [10 x i32]
%5 = alloca [1000 x i8]
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%7 = tail call dereferenceable_or_null(500) i8* @calloc(i32 500, i32 1)
%8 = icmp eq i8* %0, null
br i1 %8, label %9, label %19
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %1, i64 6
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 117
%13 = select i1 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0)
%14 = tail call i8* @strcat(i8* dereferenceable(1) %7, i8* dereferenceable(1) %13)
%15 = tail call i8* @strcat(i8* dereferenceable(1) %7, i8* dereferenceable(1) %2)
%16 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %7)
%17 = getelementptr i8, i8* %7, i64 %16
%18 = bitcast i8* %17 to i16*
store i16 10, i16* %18
br label %146
19: ; preds = %3
%20 = tail call i32 @strlen(i8* %0)
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %0, i64 %21
store i8 58, i8* %22
%23 = bitcast [10 x i32]* %4 to i8*
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
store i32 0, i32* %24
%25 = tail call i32 @strlen(i8* %0)
%26 = icmp sgt i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %19
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%29 = call i32 @bzero(i8* %28, i32 1000)
br label %144
30: ; preds = %19, %49
%31 = phi i64 [ %43, %49 ], [ 0, %19 ]
%32 = phi i32 [ %51, %49 ], [ 1, %19 ]
%33 = phi i32 [ %50, %49 ], [ 0, %19 ]
%34 = getelementptr inbounds i8, i8* %0, i64 %31
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 58
%37 = zext i1 %36 to i32
%38 = add nsw i32 %33, %37
%39 = srem i32 %38, 7
%40 = icmp eq i32 %39, 0
%41 = icmp ne i32 %38, 0
%42 = and i1 %41, %40
%43 = add nuw nsw i64 %31, 1
br i1 %42, label %44, label %49
44: ; preds = %30
%45 = add nsw i32 %32, 1
%46 = sext i32 %32 to i64
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %46
%48 = trunc i64 %43 to i32
store i32 %48, i32* %47
br label %49
49: ; preds = %30, %44
%50 = phi i32 [ 0, %44 ], [ %38, %30 ]
%51 = phi i32 [ %45, %44 ], [ %32, %30 ]
%52 = tail call i32 @strlen(i8* %0)
%53 = sext i32 %52 to i64
%54 = icmp slt i64 %43, %53
br i1 %54, label %30, label %55
55: ; preds = %49
%56 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%57 = call i32 @bzero(i8* %56, i32 1000)
%58 = icmp sgt i32 %51, 1
br i1 %58, label %59, label %144
59: ; preds = %55
%60 = add nsw i32 %51, -1
%61 = zext i32 %60 to i64
%62 = load i32, i32* %24
br label %63
63: ; preds = %59, %138
%64 = phi i32 [ %62, %59 ], [ %68, %138 ]
%65 = phi i64 [ 0, %59 ], [ %66, %138 ]
%66 = add nuw nsw i64 %65, 1
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %66
%68 = load i32, i32* %67
%69 = icmp slt i32 %64, %68
br i1 %69, label %70, label %77
70: ; preds = %63
%71 = sext i32 %64 to i64
%72 = getelementptr i8, i8* %0, i64 %71
%73 = xor i32 %64, -1
%74 = add i32 %68, %73
%75 = zext i32 %74 to i64
%76 = add nuw nsw i64 %75, 1
br label %77
77: ; preds = %70, %63
%78 = load i8, i8* %1
%79 = icmp eq i8 %78, 95
br i1 %79, label %138, label %80
80: ; preds = %77, %131
%81 = phi i64 [ %132, %131 ], [ 0, %77 ]
%82 = phi i8 [ %134, %131 ], [ %78, %77 ]
%83 = sext i8 %82 to i32
switch i32 %83, label %131 [
i32 85, label %84
i32 76, label %90
i32 71, label %96
i32 78, label %102
i32 72, label %108
i32 83, label %114
]
84: ; preds = %80
%85 = call i8* @get_value(i8* %56, i8 signext 85)
%86 = call i8* @strcat(i8* dereferenceable(1) %7, i8* dereferenceable(1) %85)
%87 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %7)
%88 = getelementptr i8, i8* %7, i64 %87
%89 = bitcast i8* %88 to i16*
store i16 32, i16* %89
br label %131
90: ; preds = %80
%91 = call i8* @get_value(i8* %56, i8 signext 76)
%92 = call i8* @strcat(i8* dereferenceable(1) %7, i8* dereferenceable(1) %91)
%93 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %7)
%94 = getelementptr i8, i8* %7, i64 %93
%95 = bitcast i8* %94 to i16*
store i16 32, i16* %95
br label %131
96: ; preds = %80
%97 = call i8* @get_value(i8* %56, i8 signext 71)
%98 = call i8* @strcat(i8* dereferenceable(1) %7, i8* dereferenceable(1) %97)
%99 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %7)
%100 = getelementptr i8, i8* %7, i64 %99
%101 = bitcast i8* %100 to i16*
store i16 32, i16* %101
br label %131
102: ; preds = %80
%103 = call i8* @get_value(i8* %56, i8 signext 78)
%104 = call i8* @strcat(i8* dereferenceable(1) %7, i8* dereferenceable(1) %103)
%105 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %7)
%106 = getelementptr i8, i8* %7, i64 %105
%107 = bitcast i8* %106 to i16*
store i16 32, i16* %107
br label %131
108: ; preds = %80
%109 = call i8* @get_value(i8* %56, i8 signext 72)
%110 = call i8* @strcat(i8* dereferenceable(1) %7, i8* dereferenceable(1) %109)
%111 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %7)
%112 = getelementptr i8, i8* %7, i64 %111
%113 = bitcast i8* %112 to i16*
store i16 32, i16* %113
br label %131
114: ; preds = %80
%115 = call i8* @get_value(i8* %56, i8 signext 83)
%116 = call i8* @strcat(i8* dereferenceable(1) %7, i8* dereferenceable(1) %115)
%117 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %7)
%118 = getelementptr i8, i8* %7, i64 %117
%119 = bitcast i8* %118 to i16*
store i16 32, i16* %119
%120 = call i32 @strlen(i8* %7)
%121 = add nsw i32 %120, -1
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %7, i64 %122
%124 = load i8, i8* %123
%125 = icmp eq i8 %124, 10
br i1 %125, label %126, label %131
126: ; preds = %114
%127 = call i32 @strlen(i8* %7)
%128 = add nsw i32 %127, -1
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i8, i8* %7, i64 %129
store i8 0, i8* %130
br label %131
131: ; preds = %114, %126, %80, %108, %102, %96, %90, %84
%132 = add nuw nsw i64 %81, 1
%133 = getelementptr inbounds i8, i8* %1, i64 %132
%134 = load i8, i8* %133
%135 = icmp ne i8 %134, 95
%136 = icmp ult i64 %81, 5
%137 = select i1 %135, i1 %136, i1 false
br i1 %137, label %80, label %138
138: ; preds = %131, %77
%139 = call i32 @strlen(i8* %7)
%140 = add nsw i32 %139, -1
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %7, i64 %141
store i8 10, i8* %142
%143 = icmp eq i64 %66, %61
br i1 %143, label %144, label %63
144: ; preds = %138, %27, %55
%145 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
br label %146
146: ; preds = %144, %9
ret i8* %7
}