#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 */
typedef int off_t;

/* Variables and functions */
char EOF;
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ SEEK_SET;
int atoi(int /*<<< orphan*/);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ do_close(int);
int /*<<< orphan*/ do_lseek(int, int, int /*<<< orphan*/);
int do_open(char *, int);
int /*<<< orphan*/ do_read(int, char *, int);
int do_stat(char *);
int /*<<< orphan*/ do_write(int, char *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char getopt(int, char **, char *);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int fd, count = 0, nc = 1, oc = 2, i;
  char *wrbuf = NULL, *rdbuf = NULL;
  off_t offset = 0, fsize = 0;
  int _count, _offset;
  char c;
  while ((c = getopt(argc, argv, "n:o:")) != EOF) {
    switch (c) {
    case 'n':
      nc = atoi(optarg);
      break;
    case 'o':
      oc = atoi(optarg);
      break;
    case '?':
    default:
      fprintf(stderr,
              "Usage: %s -n <count multiplier> -o <offset multiplier>\n",
              argv[0]);
      exit(1);
    }
  }
  if (nc <= 0 || oc <= 0) {
    fprintf(stderr, "Usage: %s -n <count multiplier> -o <offset multiplier>\n",
            argv[0]);
    exit(1);
  }
  srand(time(NULL));
  _count = (int)(nc * 16384);
  _offset = (int)(oc * 16384);
  count = rand() % _count;
  offset = rand() % _offset;
  printf("Writing %d bytes at offset %ld\n", count, offset);
  wrbuf = (char *)calloc(1, count);
  for (i = 0; i < count / sizeof(int); i++) {
    wrbuf[i] = i;
  }
  fd = do_open("/mnt/capfs/testfile", O_RDWR | O_CREAT);
  if (fd < 0) {
    printf("do_open - %s\n", strerror(errno));
    exit(1);
  }
  do_lseek(fd, offset, SEEK_SET);
  do_write(fd, wrbuf, count);
  do_close(fd);
  fsize = do_stat("/mnt/capfs/testfile");
  fd = do_open("/mnt/capfs/testfile", O_RDWR);
  rdbuf = (char *)calloc(fsize, 1);
  do_read(fd, rdbuf, fsize);
  do_close(fd);
  if (memcmp(rdbuf + offset, wrbuf, count) == 0) {
    printf("Matches\n");
  } else {
    printf("Does not match\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x2,-0x20(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd99(%rip),%rdx
call   10d0 <getopt@plt>
mov    %al,-0x49(%rbp)
movsbl %al,%eax
mov    0x2d57(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1317 <main+0x107>
movsbl -0x49(%rbp),%eax
mov    %eax,-0x50(%rbp)
sub    $0x3f,%eax
je     12e7 <main+0xd7>
jmp    1299 <main+0x89>
mov    -0x50(%rbp),%eax
sub    $0x6e,%eax
je     12bb <main+0xab>
jmp    12aa <main+0x9a>
mov    -0x50(%rbp),%eax
sub    $0x6f,%eax
je     12d1 <main+0xc1>
jmp    12ec <main+0xdc>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1312 <main+0x102>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x20(%rbp)
jmp    1312 <main+0x102>
jmp    12ec <main+0xdc>
mov    0x2ccd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd02(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
jmp    1259 <main+0x49>
cmpl   $0x0,-0x1c(%rbp)
jle    132b <main+0x11b>
cmpl   $0x0,-0x20(%rbp)
jg     1351 <main+0x141>
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xcc3(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    -0x1c(%rbp),%eax
shl    $0xe,%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%eax
shl    $0xe,%eax
mov    %eax,-0x48(%rbp)
mov    $0x0,%al
call   1130 <rand@plt>
cltd
idivl  -0x44(%rbp)
mov    %edx,-0x18(%rbp)
mov    $0x0,%al
call   1130 <rand@plt>
cltd
idivl  -0x48(%rbp)
mov    %edx,-0x3c(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x3c(%rbp),%edx
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%esi
mov    $0x1,%edi
call   1090 <calloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movslq -0x18(%rbp),%rcx
shr    $0x2,%rcx
cmp    %rcx,%rax
jae    13ee <main+0x1de>
mov    -0x24(%rbp),%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13bb <main+0x1ab>
mov    0x2be3(%rip),%rax
mov    (%rax),%esi
mov    0x2bfa(%rip),%rax
or     (%rax),%esi
lea    0xc56(%rip),%rdi
call   1050 <do_open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1442 <main+0x232>
mov    0x2b98(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xc40(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x3c(%rbp),%esi
mov    0x2b61(%rip),%rax
mov    (%rax),%edx
call   10c0 <do_lseek@plt>
mov    -0x14(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1040 <do_write@plt>
mov    -0x14(%rbp),%edi
call   10e0 <do_close@plt>
lea    0xbe9(%rip),%rdi
call   1120 <do_stat@plt>
mov    %eax,-0x40(%rbp)
mov    0x2b55(%rip),%rax
mov    (%rax),%esi
lea    0xbd1(%rip),%rdi
call   1050 <do_open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x40(%rbp),%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%edx
call   1030 <do_read@plt>
mov    -0x14(%rbp),%edi
call   10e0 <do_close@plt>
mov    -0x38(%rbp),%rdi
movslq -0x3c(%rbp),%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1080 <memcmp@plt>
cmp    $0x0,%rax
jne    14f0 <main+0x2e0>
lea    0xb9b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14fe <main+0x2ee>
lea    0xb91(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe59(%rip),%rdx
call   10e0 <getopt@plt>
mov    0x2d8d(%rip),%r13
cmp    0x0(%r13),%al
jne    12e9 <main+0xc9>
mov    $0x1,%r15d
mov    $0x2,%r14d
test   %r15d,%r15d
jle    1492 <main+0x272>
test   %r14d,%r14d
jle    1492 <main+0x272>
xor    %edi,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
shl    $0xe,%r15d
shl    $0xe,%r14d
xor    %eax,%eax
call   1140 <rand@plt>
cltd
idiv   %r15d
mov    %edx,%r15d
xor    %eax,%eax
call   1140 <rand@plt>
cltd
idiv   %r14d
mov    %edx,%r14d
lea    0xe29(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    %r15d,%esi
call   10a0 <calloc@plt>
mov    %rax,%rbp
cmp    $0x4,%r15d
jb     14c1 <main+0x2a1>
movslq %r15d,%rcx
shr    $0x2,%rcx
cmp    $0x2,%rcx
mov    $0x1,%eax
cmovae %rcx,%rax
cmp    $0x20,%rax
jae    134c <main+0x12c>
xor    %ecx,%ecx
jmp    14b4 <main+0x294>
mov    $0x2,%r14d
mov    $0x1,%r15d
lea    0xd94(%rip),%r12
jmp    1328 <main+0x108>
xchg   %ax,%ax
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
call   1100 <atoi@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   10e0 <getopt@plt>
cmp    0x0(%r13),%al
je     1259 <main+0x39>
movsbl %al,%eax
cmp    $0x6f,%eax
je     1300 <main+0xe0>
cmp    $0x6e,%eax
jne    1492 <main+0x272>
mov    0x2cb0(%rip),%rax
mov    (%rax),%edi
call   1100 <atoi@plt>
mov    %eax,%r15d
jmp    1311 <main+0xf1>
mov    %rax,%rcx
and    $0xffffffffffffffe0,%rcx
lea    -0x20(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x5,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x3,%edx
cmp    $0x60,%rdi
jae    137c <main+0x15c>
movdqa 0xc8b(%rip),%xmm0
xor    %edi,%edi
jmp    1449 <main+0x229>
and    $0xfffffffffffffffc,%rsi
movdqa 0xc78(%rip),%xmm0
xor    %edi,%edi
movdqa 0xc7d(%rip),%xmm8
movdqa 0xc84(%rip),%xmm9
movdqa 0xc8b(%rip),%xmm10
movdqa 0xc93(%rip),%xmm4
movdqa 0xc9b(%rip),%xmm5
movdqa 0xca3(%rip),%xmm6
movdqa 0xcab(%rip),%xmm7
movdqa 0xcb3(%rip),%xmm1
nopl   (%rax)
movdqa %xmm0,%xmm2
paddb  %xmm8,%xmm2
movdqu %xmm0,0x0(%rbp,%rdi,1)
movdqu %xmm2,0x10(%rbp,%rdi,1)
movdqa %xmm0,%xmm2
paddb  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddb  %xmm10,%xmm3
movdqu %xmm2,0x20(%rbp,%rdi,1)
movdqu %xmm3,0x30(%rbp,%rdi,1)
movdqa %xmm0,%xmm2
paddb  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddb  %xmm5,%xmm3
movdqu %xmm2,0x40(%rbp,%rdi,1)
movdqu %xmm3,0x50(%rbp,%rdi,1)
movdqa %xmm0,%xmm2
paddb  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddb  %xmm7,%xmm3
movdqu %xmm2,0x60(%rbp,%rdi,1)
movdqu %xmm3,0x70(%rbp,%rdi,1)
sub    $0xffffffffffffff80,%rdi
pxor   %xmm1,%xmm0
add    $0xfffffffffffffffc,%rsi
jne    13d0 <main+0x1b0>
test   %rdx,%rdx
je     14bc <main+0x29c>
lea    (%rdi,%rbp,1),%rsi
add    $0x10,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movdqa 0xbac(%rip),%xmm1
movdqa 0xbb4(%rip),%xmm2
nopl   0x0(%rax)
movdqa %xmm0,%xmm3
paddb  %xmm1,%xmm3
movdqu %xmm0,-0x10(%rsi,%rdi,1)
movdqu %xmm3,(%rsi,%rdi,1)
paddb  %xmm2,%xmm0
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    1470 <main+0x250>
jmp    14bc <main+0x29c>
mov    0x2b27(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xbf0(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    %cl,0x0(%rbp,%rcx,1)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    14b4 <main+0x294>
mov    0x2b10(%rip),%rcx
mov    0x2b29(%rip),%rax
mov    (%rax),%esi
or     (%rcx),%esi
lea    0xc13(%rip),%rdi
call   1060 <do_open@plt>
test   %eax,%eax
js     1598 <main+0x378>
mov    %eax,%ebx
mov    0x2ac0(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14d,%esi
call   10d0 <do_lseek@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1040 <do_write@plt>
mov    %ebx,%edi
call   10f0 <do_close@plt>
lea    0xbd6(%rip),%r12
mov    %r12,%rdi
call   1130 <do_stat@plt>
mov    %eax,%r13d
mov    0x2aaf(%rip),%rax
mov    (%rax),%esi
mov    %r12,%rdi
call   1060 <do_open@plt>
mov    %eax,%r12d
mov    %r13d,%edi
mov    $0x1,%esi
call   10a0 <calloc@plt>
mov    %rax,%rbx
mov    %r12d,%edi
mov    %rax,%rsi
mov    %r13d,%edx
call   1030 <do_read@plt>
mov    %r12d,%edi
call   10f0 <do_close@plt>
movslq %r14d,%rdi
add    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1090 <memcmp@plt>
test   %rax,%rax
lea    0xba7(%rip),%rax
lea    0xb91(%rip),%rdi
cmove  %rax,%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a19(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xb54(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"n:o:\00"
@EOF = global i8 0
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [56 x i8] c"Usage: %s -n <count multiplier> -o <offset multiplier>\0A\00"
@.str.2 = [32 x i8] c"Writing %d bytes at offset %ld\0A\00"
@.str.3 = [20 x i8] c"/mnt/capfs/testfile\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.4 = [14 x i8] c"do_open - %s\0A\00"
@errno = global i32 0
@SEEK_SET = global i32 0
@.str.5 = [9 x i8] c"Matches\0A\00"
@.str.6 = [16 x i8] c"Does not match\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 1, i32* %8
store i32 2, i32* %9
store i8* null, i8** %11
store i8* null, i8** %12
store i32 0, i32* %13
store i32 0, i32* %14
br label %18
18: ; preds = %43, %2
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = call signext i8 @getopt(i32 %19, i8** %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8 %21, i8* %17
%22 = sext i8 %21 to i32
%23 = load i8, i8* @EOF
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %22, %24
br i1 %25, label %26, label %44
26: ; preds = %18
%27 = load i8, i8* %17
%28 = sext i8 %27 to i32
switch i32 %28, label %36 [
i32 110, label %29
i32 111, label %32
i32 63, label %35
]
29: ; preds = %26
%30 = load i32, i32* @optarg
%31 = call i32 @atoi(i32 %30)
store i32 %31, i32* %8
br label %43
32: ; preds = %26
%33 = load i32, i32* @optarg
%34 = call i32 @atoi(i32 %33)
store i32 %34, i32* %9
br label %43
35: ; preds = %26
br label %36
36: ; preds = %26, %35
%37 = load i32, i32* @stderr
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %40)
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %32, %29
br label %18
44: ; preds = %18
%45 = load i32, i32* %8
%46 = icmp sle i32 %45, 0
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i32, i32* %9
%49 = icmp sle i32 %48, 0
br i1 %49, label %50, label %57
50: ; preds = %47, %44
%51 = load i32, i32* @stderr
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 0
%54 = load i8*, i8** %53
%55 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %54)
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %47
%58 = call i32 @time(i32* null)
%59 = call i32 @srand(i32 %58)
%60 = load i32, i32* %8
%61 = mul nsw i32 %60, 16384
store i32 %61, i32* %15
%62 = load i32, i32* %9
%63 = mul nsw i32 %62, 16384
store i32 %63, i32* %16
%64 = call i32 (...) @rand()
%65 = load i32, i32* %15
%66 = srem i32 %64, %65
store i32 %66, i32* %7
%67 = call i32 (...) @rand()
%68 = load i32, i32* %16
%69 = srem i32 %67, %68
store i32 %69, i32* %13
%70 = load i32, i32* %7
%71 = load i32, i32* %13
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %70, i32 %71)
%73 = load i32, i32* %7
%74 = call i64 @calloc(i32 1, i32 %73)
%75 = inttoptr i64 %74 to i8*
store i8* %75, i8** %11
store i32 0, i32* %10
br label %76
76: ; preds = %90, %57
%77 = load i32, i32* %10
%78 = sext i32 %77 to i64
%79 = load i32, i32* %7
%80 = sext i32 %79 to i64
%81 = udiv i64 %80, 4
%82 = icmp ult i64 %78, %81
br i1 %82, label %83, label %93
83: ; preds = %76
%84 = load i32, i32* %10
%85 = trunc i32 %84 to i8
%86 = load i8*, i8** %11
%87 = load i32, i32* %10
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %86, i64 %88
store i8 %85, i8* %89
br label %90
90: ; preds = %83
%91 = load i32, i32* %10
%92 = add nsw i32 %91, 1
store i32 %92, i32* %10
br label %76
93: ; preds = %76
%94 = load i32, i32* @O_RDWR
%95 = load i32, i32* @O_CREAT
%96 = or i32 %94, %95
%97 = call i32 @do_open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %96)
store i32 %97, i32* %6
%98 = load i32, i32* %6
%99 = icmp slt i32 %98, 0
br i1 %99, label %100, label %105
100: ; preds = %93
%101 = load i32, i32* @errno
%102 = call i8* @strerror(i32 %101)
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %102)
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %93
%106 = load i32, i32* %6
%107 = load i32, i32* %13
%108 = load i32, i32* @SEEK_SET
%109 = call i32 @do_lseek(i32 %106, i32 %107, i32 %108)
%110 = load i32, i32* %6
%111 = load i8*, i8** %11
%112 = load i32, i32* %7
%113 = call i32 @do_write(i32 %110, i8* %111, i32 %112)
%114 = load i32, i32* %6
%115 = call i32 @do_close(i32 %114)
%116 = call i32 @do_stat(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 %116, i32* %14
%117 = load i32, i32* @O_RDWR
%118 = call i32 @do_open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %117)
store i32 %118, i32* %6
%119 = load i32, i32* %14
%120 = call i64 @calloc(i32 %119, i32 1)
%121 = inttoptr i64 %120 to i8*
store i8* %121, i8** %12
%122 = load i32, i32* %6
%123 = load i8*, i8** %12
%124 = load i32, i32* %14
%125 = call i32 @do_read(i32 %122, i8* %123, i32 %124)
%126 = load i32, i32* %6
%127 = call i32 @do_close(i32 %126)
%128 = load i8*, i8** %12
%129 = load i32, i32* %13
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %128, i64 %130
%132 = load i8*, i8** %11
%133 = load i32, i32* %7
%134 = call i64 @memcmp(i8* %131, i8* %132, i32 %133)
%135 = icmp eq i64 %134, 0
br i1 %135, label %136, label %138
136: ; preds = %105
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %140
138: ; preds = %105
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %140
140: ; preds = %138, %136
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"n:o:\00"
@EOF = global i8 0
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [56 x i8] c"Usage: %s -n <count multiplier> -o <offset multiplier>\0A\00"
@.str.2 = [32 x i8] c"Writing %d bytes at offset %ld\0A\00"
@.str.3 = [20 x i8] c"/mnt/capfs/testfile\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.4 = [14 x i8] c"do_open - %s\0A\00"
@errno = global i32 0
@SEEK_SET = global i32 0
@str = [15 x i8] c"Does not match\00"
@str.7 = [8 x i8] c"Matches\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %28, label %6
6: ; preds = %2, %22
%7 = phi i8 [ %25, %22 ], [ %3, %2 ]
%8 = phi i32 [ %24, %22 ], [ 1, %2 ]
%9 = phi i32 [ %23, %22 ], [ 2, %2 ]
%10 = sext i8 %7 to i32
switch i32 %10, label %17 [
i32 110, label %11
i32 111, label %14
]
11: ; preds = %6
%12 = load i32, i32* @optarg
%13 = tail call i32 @atoi(i32 %12)
br label %22
14: ; preds = %6
%15 = load i32, i32* @optarg
%16 = tail call i32 @atoi(i32 %15)
br label %22
17: ; preds = %6
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %1
%20 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %14, %11
%23 = phi i32 [ %16, %14 ], [ %9, %11 ]
%24 = phi i32 [ %8, %14 ], [ %13, %11 ]
%25 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%26 = load i8, i8* @EOF
%27 = icmp eq i8 %25, %26
br i1 %27, label %28, label %6
28: ; preds = %22, %2
%29 = phi i32 [ 2, %2 ], [ %23, %22 ]
%30 = phi i32 [ 1, %2 ], [ %24, %22 ]
%31 = icmp slt i32 %30, 1
%32 = icmp slt i32 %29, 1
%33 = select i1 %31, i1 true, i1 %32
br i1 %33, label %34, label %39
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = load i8*, i8** %1
%37 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %36)
%38 = tail call i32 @exit(i32 1)
unreachable
39: ; preds = %28
%40 = tail call i32 @time(i32* null)
%41 = tail call i32 @srand(i32 %40)
%42 = shl nsw i32 %30, 14
%43 = shl nsw i32 %29, 14
%44 = tail call i32 (...) @rand()
%45 = srem i32 %44, %42
%46 = tail call i32 (...) @rand()
%47 = srem i32 %46, %43
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %45, i32 %47)
%49 = tail call i64 @calloc(i32 1, i32 %45)
%50 = inttoptr i64 %49 to i8*
%51 = icmp ult i32 %45, 4
br i1 %51, label %127, label %52
52: ; preds = %39
%53 = sext i32 %45 to i64
%54 = lshr i64 %53, 2
%55 = call i64 @llvm.umax.i64(i64 %54, i64 1)
%56 = icmp ult i64 %55, 32
br i1 %56, label %119, label %57
57: ; preds = %52
%58 = and i64 %55, 4611686018427387872
%59 = add nsw i64 %58, -32
%60 = lshr exact i64 %59, 5
%61 = add nuw nsw i64 %60, 1
%62 = and i64 %61, 3
%63 = icmp ult i64 %59, 96
br i1 %63, label %100, label %64
64: ; preds = %57
%65 = and i64 %61, 1152921504606846972
br label %66
66: ; preds = %66, %64
%67 = phi i64 [ 0, %64 ], [ %96, %66 ]
%68 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %64 ], [ %97, %66 ]
%69 = phi i64 [ 0, %64 ], [ %98, %66 ]
%70 = add <16 x i8> %68, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%71 = getelementptr inbounds i8, i8* %50, i64 %67
%72 = bitcast i8* %71 to <16 x i8>*
store <16 x i8> %68, <16 x i8>* %72
%73 = getelementptr inbounds i8, i8* %71, i64 16
%74 = bitcast i8* %73 to <16 x i8>*
store <16 x i8> %70, <16 x i8>* %74
%75 = or i64 %67, 32
%76 = add <16 x i8> %68, <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%77 = add <16 x i8> %68, <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>
%78 = getelementptr inbounds i8, i8* %50, i64 %75
%79 = bitcast i8* %78 to <16 x i8>*
store <16 x i8> %76, <16 x i8>* %79
%80 = getelementptr inbounds i8, i8* %78, i64 16
%81 = bitcast i8* %80 to <16 x i8>*
store <16 x i8> %77, <16 x i8>* %81
%82 = or i64 %67, 64
%83 = add <16 x i8> %68, <i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64>
%84 = add <16 x i8> %68, <i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80>
%85 = getelementptr inbounds i8, i8* %50, i64 %82
%86 = bitcast i8* %85 to <16 x i8>*
store <16 x i8> %83, <16 x i8>* %86
%87 = getelementptr inbounds i8, i8* %85, i64 16
%88 = bitcast i8* %87 to <16 x i8>*
store <16 x i8> %84, <16 x i8>* %88
%89 = or i64 %67, 96
%90 = add <16 x i8> %68, <i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96>
%91 = add <16 x i8> %68, <i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112>
%92 = getelementptr inbounds i8, i8* %50, i64 %89
%93 = bitcast i8* %92 to <16 x i8>*
store <16 x i8> %90, <16 x i8>* %93
%94 = getelementptr inbounds i8, i8* %92, i64 16
%95 = bitcast i8* %94 to <16 x i8>*
store <16 x i8> %91, <16 x i8>* %95
%96 = add nuw i64 %67, 128
%97 = xor <16 x i8> %68, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
%98 = add i64 %69, 4
%99 = icmp eq i64 %98, %65
br i1 %99, label %100, label %66
100: ; preds = %66, %57
%101 = phi i64 [ 0, %57 ], [ %96, %66 ]
%102 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %57 ], [ %97, %66 ]
%103 = icmp eq i64 %62, 0
br i1 %103, label %117, label %104
104: ; preds = %100, %104
%105 = phi i64 [ %113, %104 ], [ %101, %100 ]
%106 = phi <16 x i8> [ %114, %104 ], [ %102, %100 ]
%107 = phi i64 [ %115, %104 ], [ 0, %100 ]
%108 = add <16 x i8> %106, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%109 = getelementptr inbounds i8, i8* %50, i64 %105
%110 = bitcast i8* %109 to <16 x i8>*
store <16 x i8> %106, <16 x i8>* %110
%111 = getelementptr inbounds i8, i8* %109, i64 16
%112 = bitcast i8* %111 to <16 x i8>*
store <16 x i8> %108, <16 x i8>* %112
%113 = add nuw i64 %105, 32
%114 = add <16 x i8> %106, <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%115 = add i64 %107, 1
%116 = icmp eq i64 %115, %62
br i1 %116, label %117, label %104
117: ; preds = %104, %100
%118 = icmp eq i64 %55, %58
br i1 %118, label %127, label %119
119: ; preds = %52, %117
%120 = phi i64 [ 0, %52 ], [ %58, %117 ]
br label %121
121: ; preds = %119, %121
%122 = phi i64 [ %125, %121 ], [ %120, %119 ]
%123 = trunc i64 %122 to i8
%124 = getelementptr inbounds i8, i8* %50, i64 %122
store i8 %123, i8* %124
%125 = add nuw nsw i64 %122, 1
%126 = icmp eq i64 %125, %55
br i1 %126, label %127, label %121
127: ; preds = %121, %117, %39
%128 = load i32, i32* @O_RDWR
%129 = load i32, i32* @O_CREAT
%130 = or i32 %129, %128
%131 = tail call i32 @do_open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %130)
%132 = icmp slt i32 %131, 0
br i1 %132, label %133, label %138
133: ; preds = %127
%134 = load i32, i32* @errno
%135 = tail call i8* @strerror(i32 %134)
%136 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %135)
%137 = tail call i32 @exit(i32 1)
unreachable
138: ; preds = %127
%139 = load i32, i32* @SEEK_SET
%140 = tail call i32 @do_lseek(i32 %131, i32 %47, i32 %139)
%141 = tail call i32 @do_write(i32 %131, i8* %50, i32 %45)
%142 = tail call i32 @do_close(i32 %131)
%143 = tail call i32 @do_stat(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%144 = load i32, i32* @O_RDWR
%145 = tail call i32 @do_open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %144)
%146 = tail call i64 @calloc(i32 %143, i32 1)
%147 = inttoptr i64 %146 to i8*
%148 = tail call i32 @do_read(i32 %145, i8* %147, i32 %143)
%149 = tail call i32 @do_close(i32 %145)
%150 = sext i32 %47 to i64
%151 = getelementptr inbounds i8, i8* %147, i64 %150
%152 = tail call i64 @memcmp(i8* %151, i8* %50, i32 %45)
%153 = icmp eq i64 %152, 0
%154 = select i1 %153, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0)
%155 = tail call i32 @puts(i8* dereferenceable(1) %154)
ret i32 0
}