#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*/ abort();
unsigned char *calloc(int, size_t);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ free(unsigned char *);
unsigned char *malloc(size_t);
int /*<<< orphan*/ memcmp(unsigned char *, unsigned char *, size_t);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vsd_deinit();
int /*<<< orphan*/ vsd_get_size(size_t *);
int /*<<< orphan*/ vsd_init();
size_t vsd_read(unsigned char *, size_t);
int /*<<< orphan*/ vsd_set_size(size_t);
size_t vsd_write(unsigned char *, size_t);
int main() {
  if (!(!vsd_init())) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        16);
    perror("Test failed");
    abort();
  };
  size_t vsd_size = 0;
  if (!(!vsd_get_size(&vsd_size))) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        19);
    perror("Test failed");
    abort();
  };
  if (!(vsd_set_size(vsd_size * 2))) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        20);
    perror("Test failed");
    abort();
  };
  unsigned char *vsd_w_buf = malloc(vsd_size);
  unsigned char *vsd_r_buf = calloc(1, vsd_size);
  size_t i = 0;
  for (; i < vsd_size; ++i) {
    vsd_w_buf[i] = i % 255;
  }
  if (!(vsd_write(vsd_w_buf, vsd_size) == vsd_size)) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        30);
    perror("Test failed");
    abort();
  };
  if (!(vsd_read(vsd_r_buf, vsd_size) == vsd_size)) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        31);
    perror("Test failed");
    abort();
  };
  if (!(!memcmp(vsd_w_buf, vsd_r_buf, vsd_size))) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        32);
    perror("Test failed");
    abort();
  };
  size_t vsd_new_size = vsd_size / 2;
  if (!(!vsd_set_size(vsd_new_size))) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        36);
    perror("Test failed");
    abort();
  };
  if (!(!vsd_get_size(&vsd_size))) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        37);
    perror("Test failed");
    abort();
  };
  if (!(vsd_size == vsd_new_size)) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        38);
    perror("Test failed");
    abort();
  };
  if (!(!vsd_deinit())) {
    fprintf(
        stderr, "%s %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/"
        "refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c",
        40);
    perror("Test failed");
    abort();
  };
  free(vsd_w_buf);
  free(vsd_r_buf);
  printf("Ok\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10a0 <vsd_init@plt>
cmp    $0x0,%eax
je     1233 <main+0x53>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
lea    0xdf1(%rip),%rsi
lea    0xdf1(%rip),%rdx
mov    $0x10,%ecx
call   1090 <fprintf@plt>
lea    0xe99(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   10b0 <vsd_get_size@plt>
cmp    $0x0,%eax
je     1281 <main+0xa1>
mov    0x2d8c(%rip),%rax
mov    (%rax),%edi
lea    0xda3(%rip),%rsi
lea    0xda3(%rip),%rdx
mov    $0x13,%ecx
call   1090 <fprintf@plt>
lea    0xe4b(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x10(%rbp),%rdi
shl    $0x1,%rdi
call   10f0 <vsd_set_size@plt>
cmp    $0x0,%eax
jne    12cb <main+0xeb>
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
lea    0xd59(%rip),%rsi
lea    0xd59(%rip),%rdx
mov    $0x14,%ecx
call   1090 <fprintf@plt>
lea    0xe01(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x1,%edi
call   1080 <calloc@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    132a <main+0x14a>
mov    -0x28(%rbp),%rax
mov    $0xff,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    12f2 <main+0x112>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1100 <vsd_write@plt>
cmp    -0x10(%rbp),%rax
je     1375 <main+0x195>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
lea    0xcaf(%rip),%rsi
lea    0xcaf(%rip),%rdx
mov    $0x1e,%ecx
call   1090 <fprintf@plt>
lea    0xd57(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10d0 <vsd_read@plt>
cmp    -0x10(%rbp),%rax
je     13c0 <main+0x1e0>
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
lea    0xc64(%rip),%rsi
lea    0xc64(%rip),%rdx
mov    $0x1f,%ecx
call   1090 <fprintf@plt>
lea    0xd0c(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1070 <memcmp@plt>
cmp    $0x0,%eax
je     140e <main+0x22e>
mov    0x2bff(%rip),%rax
mov    (%rax),%edi
lea    0xc16(%rip),%rsi
lea    0xc16(%rip),%rdx
mov    $0x20,%ecx
call   1090 <fprintf@plt>
lea    0xcbe(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   10f0 <vsd_set_size@plt>
cmp    $0x0,%eax
je     1460 <main+0x280>
mov    0x2bad(%rip),%rax
mov    (%rax),%edi
lea    0xbc4(%rip),%rsi
lea    0xbc4(%rip),%rdx
mov    $0x24,%ecx
call   1090 <fprintf@plt>
lea    0xc6c(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
lea    -0x10(%rbp),%rdi
call   10b0 <vsd_get_size@plt>
cmp    $0x0,%eax
je     14a6 <main+0x2c6>
mov    0x2b67(%rip),%rax
mov    (%rax),%edi
lea    0xb7e(%rip),%rsi
lea    0xb7e(%rip),%rdx
mov    $0x25,%ecx
call   1090 <fprintf@plt>
lea    0xc26(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x10(%rbp),%rax
cmp    -0x30(%rbp),%rax
je     14e8 <main+0x308>
mov    0x2b25(%rip),%rax
mov    (%rax),%edi
lea    0xb3c(%rip),%rsi
lea    0xb3c(%rip),%rdx
mov    $0x26,%ecx
call   1090 <fprintf@plt>
lea    0xbe4(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    $0x0,%al
call   1050 <vsd_deinit@plt>
cmp    $0x0,%eax
je     152c <main+0x34c>
mov    0x2ae1(%rip),%rax
mov    (%rax),%edi
lea    0xaf8(%rip),%rsi
lea    0xaf8(%rip),%rdx
mov    $0x28,%ecx
call   1090 <fprintf@plt>
lea    0xba0(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
lea    0xb87(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1090 <vsd_init@plt>
test   %eax,%eax
jne    135c <main+0x17c>
movq   $0x0,(%rsp)
mov    %rsp,%rdi
call   10a0 <vsd_get_size@plt>
test   %eax,%eax
jne    137d <main+0x19d>
mov    (%rsp),%rdi
add    %rdi,%rdi
call   10f0 <vsd_set_size@plt>
test   %eax,%eax
je     139e <main+0x1be>
mov    (%rsp),%r14
mov    %r14,%rdi
call   10b0 <malloc@plt>
mov    %rax,%r12
mov    $0x1,%edi
mov    %r14,%rsi
call   1070 <calloc@plt>
mov    %rax,%r14
mov    (%rsp),%rsi
test   %rsi,%rsi
je     12b6 <main+0xd6>
movabs $0x8080808080808081,%r8
80 80 80
cmp    $0x1,%rsi
jne    125f <main+0x7f>
xor    %ecx,%ecx
jmp    12a1 <main+0xc1>
mov    %rsi,%r9
and    $0xfffffffffffffffe,%r9
mov    $0x1,%edi
xor    %ecx,%ecx
nopl   (%rax)
mov    %rdi,%rax
mul    %r8
mov    %rdx,%rbx
shr    $0x7,%rbx
mov    %rcx,%rax
mul    %r8
add    %dil,%bl
shr    $0x7,%edx
add    %ecx,%edx
mov    %dl,(%r12,%rcx,1)
mov    %bl,0x1(%r12,%rcx,1)
add    $0x2,%rcx
add    $0x2,%rdi
cmp    %rcx,%r9
jne    1270 <main+0x90>
test   $0x1,%sil
je     12b6 <main+0xd6>
mov    %rcx,%rax
mul    %r8
shr    $0x7,%edx
add    %ecx,%edx
mov    %dl,(%r12,%rcx,1)
mov    %r12,%rdi
call   1100 <vsd_write@plt>
cmp    (%rsp),%rax
jne    13bf <main+0x1df>
mov    %r14,%rdi
mov    %rax,%rsi
call   10d0 <vsd_read@plt>
cmp    (%rsp),%rax
jne    13e0 <main+0x200>
mov    %rax,%r15
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   10c0 <bcmp@plt>
test   %eax,%eax
jne    1401 <main+0x221>
shr    %r15
mov    %r15,%rdi
call   10f0 <vsd_set_size@plt>
test   %eax,%eax
jne    141f <main+0x23f>
mov    %rsp,%rdi
call   10a0 <vsd_get_size@plt>
test   %eax,%eax
jne    143d <main+0x25d>
cmp    %r15,(%rsp)
jne    145b <main+0x27b>
xor    %eax,%eax
call   1060 <vsd_deinit@plt>
test   %eax,%eax
jne    1479 <main+0x299>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
lea    0xd83(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2c7d(%rip),%rax
mov    (%rax),%edi
lea    0xc94(%rip),%rsi
lea    0xc94(%rip),%rdx
mov    $0x10,%ecx
jmp    1495 <main+0x2b5>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
lea    0xc73(%rip),%rsi
lea    0xc73(%rip),%rdx
mov    $0x13,%ecx
jmp    1495 <main+0x2b5>
mov    0x2c3b(%rip),%rax
mov    (%rax),%edi
lea    0xc52(%rip),%rsi
lea    0xc52(%rip),%rdx
mov    $0x14,%ecx
jmp    1495 <main+0x2b5>
mov    0x2c1a(%rip),%rax
mov    (%rax),%edi
lea    0xc31(%rip),%rsi
lea    0xc31(%rip),%rdx
mov    $0x1e,%ecx
jmp    1495 <main+0x2b5>
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
lea    0xc10(%rip),%rsi
lea    0xc10(%rip),%rdx
mov    $0x1f,%ecx
jmp    1495 <main+0x2b5>
mov    0x2bd8(%rip),%rax
mov    (%rax),%edi
lea    0xbef(%rip),%rsi
lea    0xbef(%rip),%rdx
mov    $0x20,%ecx
jmp    1495 <main+0x2b5>
mov    0x2bba(%rip),%rax
mov    (%rax),%edi
lea    0xbd1(%rip),%rsi
lea    0xbd1(%rip),%rdx
mov    $0x24,%ecx
jmp    1495 <main+0x2b5>
mov    0x2b9c(%rip),%rax
mov    (%rax),%edi
lea    0xbb3(%rip),%rsi
lea    0xbb3(%rip),%rdx
mov    $0x25,%ecx
jmp    1495 <main+0x2b5>
mov    0x2b7e(%rip),%rax
mov    (%rax),%edi
lea    0xb95(%rip),%rsi
lea    0xb95(%rip),%rdx
mov    $0x26,%ecx
jmp    1495 <main+0x2b5>
mov    0x2b60(%rip),%rax
mov    (%rax),%edi
lea    0xb77(%rip),%rsi
lea    0xb77(%rip),%rdx
mov    $0x28,%ecx
call   1080 <fprintf@plt>
lea    0xc1f(%rip),%rdi
call   10e0 <perror@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"%s %d\0A\00"
@.str.1 = [185 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c\00"
@.str.2 = [12 x i8] c"Test failed\00"
@.str.3 = [4 x i8] c"Ok\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i32 0, i32* %1
%7 = call i32 (...) @vsd_init()
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 16)
%12 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %0
store i64 0, i64* %2
%15 = call i32 @vsd_get_size(i64* %2)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 19)
%20 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 (...) @abort()
unreachable
22: ; preds = %14
%23 = load i64, i64* %2
%24 = mul i64 %23, 2
%25 = call i32 @vsd_set_size(i64 %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %32, label %27
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 20)
%30 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 (...) @abort()
unreachable
32: ; preds = %22
%33 = load i64, i64* %2
%34 = call i8* @malloc(i64 %33)
store i8* %34, i8** %3
%35 = load i64, i64* %2
%36 = call i8* @calloc(i32 1, i64 %35)
store i8* %36, i8** %4
store i64 0, i64* %5
br label %37
37: ; preds = %48, %32
%38 = load i64, i64* %5
%39 = load i64, i64* %2
%40 = icmp ult i64 %38, %39
br i1 %40, label %41, label %51
41: ; preds = %37
%42 = load i64, i64* %5
%43 = urem i64 %42, 255
%44 = trunc i64 %43 to i8
%45 = load i8*, i8** %3
%46 = load i64, i64* %5
%47 = getelementptr inbounds i8, i8* %45, i64 %46
store i8 %44, i8* %47
br label %48
48: ; preds = %41
%49 = load i64, i64* %5
%50 = add i64 %49, 1
store i64 %50, i64* %5
br label %37
51: ; preds = %37
%52 = load i8*, i8** %3
%53 = load i64, i64* %2
%54 = call i64 @vsd_write(i8* %52, i64 %53)
%55 = load i64, i64* %2
%56 = icmp eq i64 %54, %55
br i1 %56, label %62, label %57
57: ; preds = %51
%58 = load i32, i32* @stderr
%59 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 30)
%60 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%61 = call i32 (...) @abort()
unreachable
62: ; preds = %51
%63 = load i8*, i8** %4
%64 = load i64, i64* %2
%65 = call i64 @vsd_read(i8* %63, i64 %64)
%66 = load i64, i64* %2
%67 = icmp eq i64 %65, %66
br i1 %67, label %73, label %68
68: ; preds = %62
%69 = load i32, i32* @stderr
%70 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 31)
%71 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%72 = call i32 (...) @abort()
unreachable
73: ; preds = %62
%74 = load i8*, i8** %3
%75 = load i8*, i8** %4
%76 = load i64, i64* %2
%77 = call i32 @memcmp(i8* %74, i8* %75, i64 %76)
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %84
79: ; preds = %73
%80 = load i32, i32* @stderr
%81 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 32)
%82 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%83 = call i32 (...) @abort()
unreachable
84: ; preds = %73
%85 = load i64, i64* %2
%86 = udiv i64 %85, 2
store i64 %86, i64* %6
%87 = load i64, i64* %6
%88 = call i32 @vsd_set_size(i64 %87)
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %95
90: ; preds = %84
%91 = load i32, i32* @stderr
%92 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 36)
%93 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%94 = call i32 (...) @abort()
unreachable
95: ; preds = %84
%96 = call i32 @vsd_get_size(i64* %2)
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %103
98: ; preds = %95
%99 = load i32, i32* @stderr
%100 = call i32 @fprintf(i32 %99, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 37)
%101 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%102 = call i32 (...) @abort()
unreachable
103: ; preds = %95
%104 = load i64, i64* %2
%105 = load i64, i64* %6
%106 = icmp eq i64 %104, %105
br i1 %106, label %112, label %107
107: ; preds = %103
%108 = load i32, i32* @stderr
%109 = call i32 @fprintf(i32 %108, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 38)
%110 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%111 = call i32 (...) @abort()
unreachable
112: ; preds = %103
%113 = call i32 (...) @vsd_deinit()
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %120
115: ; preds = %112
%116 = load i32, i32* @stderr
%117 = call i32 @fprintf(i32 %116, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 40)
%118 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%119 = call i32 (...) @abort()
unreachable
120: ; preds = %112
%121 = load i8*, i8** %3
%122 = call i32 @free(i8* %121)
%123 = load i8*, i8** %4
%124 = call i32 @free(i8* %123)
%125 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%s %d\0A\00"
@.str.1 = [185 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/GolovanovSrg/au-linux-kernel-spring-2016/refs/heads/master/tasks/vsd3/vsd_userspace/vsd_test.c\00"
@.str.2 = [12 x i8] c"Test failed\00"
@str = [3 x i8] c"Ok\00"
define i32 @main() {
%1 = alloca i64
%2 = tail call i32 (...) @vsd_init()
%3 = icmp eq i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 16)
%7 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %0
%10 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%11 = call i32 @vsd_get_size(i64* %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %9
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 19)
%16 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %9
%19 = load i64, i64* %1
%20 = shl i64 %19, 1
%21 = call i32 @vsd_set_size(i64 %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 20)
%26 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 (...) @abort()
unreachable
28: ; preds = %18
%29 = load i64, i64* %1
%30 = call i8* @malloc(i64 %29)
%31 = call i8* @calloc(i32 1, i64 %29)
%32 = load i64, i64* %1
%33 = icmp eq i64 %32, 0
br i1 %33, label %59, label %34
34: ; preds = %28
%35 = and i64 %32, 1
%36 = icmp eq i64 %32, 1
br i1 %36, label %52, label %37
37: ; preds = %34
%38 = and i64 %32, -2
br label %39
39: ; preds = %39, %37
%40 = phi i64 [ 0, %37 ], [ %49, %39 ]
%41 = phi i64 [ 0, %37 ], [ %50, %39 ]
%42 = urem i64 %40, 255
%43 = trunc i64 %42 to i8
%44 = getelementptr inbounds i8, i8* %30, i64 %40
store i8 %43, i8* %44
%45 = or i64 %40, 1
%46 = urem i64 %45, 255
%47 = trunc i64 %46 to i8
%48 = getelementptr inbounds i8, i8* %30, i64 %45
store i8 %47, i8* %48
%49 = add nuw i64 %40, 2
%50 = add i64 %41, 2
%51 = icmp eq i64 %50, %38
br i1 %51, label %52, label %39
52: ; preds = %39, %34
%53 = phi i64 [ 0, %34 ], [ %49, %39 ]
%54 = icmp eq i64 %35, 0
br i1 %54, label %59, label %55
55: ; preds = %52
%56 = urem i64 %53, 255
%57 = trunc i64 %56 to i8
%58 = getelementptr inbounds i8, i8* %30, i64 %53
store i8 %57, i8* %58
br label %59
59: ; preds = %55, %52, %28
%60 = call i64 @vsd_write(i8* %30, i64 %32)
%61 = load i64, i64* %1
%62 = icmp eq i64 %60, %61
br i1 %62, label %68, label %63
63: ; preds = %59
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 30)
%66 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%67 = call i32 (...) @abort()
unreachable
68: ; preds = %59
%69 = call i64 @vsd_read(i8* %31, i64 %60)
%70 = load i64, i64* %1
%71 = icmp eq i64 %69, %70
br i1 %71, label %77, label %72
72: ; preds = %68
%73 = load i32, i32* @stderr
%74 = call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 31)
%75 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%76 = call i32 (...) @abort()
unreachable
77: ; preds = %68
%78 = call i32 @bcmp(i8* %30, i8* %31, i64 %69)
%79 = icmp eq i32 %78, 0
br i1 %79, label %85, label %80
80: ; preds = %77
%81 = load i32, i32* @stderr
%82 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 32)
%83 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%84 = call i32 (...) @abort()
unreachable
85: ; preds = %77
%86 = lshr i64 %69, 1
%87 = call i32 @vsd_set_size(i64 %86)
%88 = icmp eq i32 %87, 0
br i1 %88, label %94, label %89
89: ; preds = %85
%90 = load i32, i32* @stderr
%91 = call i32 @fprintf(i32 %90, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 36)
%92 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%93 = call i32 (...) @abort()
unreachable
94: ; preds = %85
%95 = call i32 @vsd_get_size(i64* %1)
%96 = icmp eq i32 %95, 0
br i1 %96, label %102, label %97
97: ; preds = %94
%98 = load i32, i32* @stderr
%99 = call i32 @fprintf(i32 %98, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 37)
%100 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%101 = call i32 (...) @abort()
unreachable
102: ; preds = %94
%103 = load i64, i64* %1
%104 = icmp eq i64 %103, %86
br i1 %104, label %110, label %105
105: ; preds = %102
%106 = load i32, i32* @stderr
%107 = call i32 @fprintf(i32 %106, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 38)
%108 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%109 = call i32 (...) @abort()
unreachable
110: ; preds = %102
%111 = call i32 (...) @vsd_deinit()
%112 = icmp eq i32 %111, 0
br i1 %112, label %118, label %113
113: ; preds = %110
%114 = load i32, i32* @stderr
%115 = call i32 @fprintf(i32 %114, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0), i32 40)
%116 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%117 = call i32 (...) @abort()
unreachable
118: ; preds = %110
%119 = call i32 @free(i8* %30)
%120 = call i32 @free(i8* %31)
%121 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 0
}