#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 */
struct fb_var_screeninfo {
  int xres;
  int yres;
  int xres_virtual;
  int yres_virtual;
  int xoffset;
  int yoffset;
  int height;
  int width;
  unsigned long line_length;
};
struct fb_fix_screeninfo {
  int xres;
  int yres;
  int xres_virtual;
  int yres_virtual;
  int xoffset;
  int yoffset;
  int height;
  int width;
  unsigned long line_length;
};

/* Variables and functions */
int /*<<< orphan*/ FBIOGET_FSCREENINFO;
int /*<<< orphan*/ FBIOGET_VSCREENINFO;
void *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct fb_var_screeninfo *);
unsigned char *mmap(int /*<<< orphan*/ *, unsigned long, int,
                    int /*<<< orphan*/, int, int /*<<< orphan*/);
scalar_t__ munmap(unsigned char *, unsigned long);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int fd;
  char *devfb = "/dev/fb0";
  struct fb_fix_screeninfo finfo;
  struct fb_var_screeninfo vinfo;
  unsigned long screensize;
  unsigned long pos;
  unsigned char *start;
  unsigned long x, y;
  fd = open(devfb, O_RDWR);
  if (fd < 0) {
    fprintf(stderr, "open %s failed: %s\n", devfb, strerror(errno));
    exit(1);
  }
  if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0) {
    fprintf(stderr, "get fixed screen information failed: %s\n",
            strerror(errno));
    return -1;
  }
  if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) {
    fprintf(stderr, "get var screen information failed: %s\n", strerror(errno));
    return -1;
  }
  fprintf(stdout, "vinfo: xres %u, yres %u\n", vinfo.xres, vinfo.yres);
  fprintf(stdout, "vinfo: xres_vir %u, yres_vir %u\n", vinfo.xres_virtual,
          vinfo.yres_virtual);
  fprintf(stdout, "vinfo: xoffset %u, yresoffset %u\n", vinfo.xoffset,
          vinfo.yoffset);
  fprintf(stdout, "vinfo: height %u, width %u\n", vinfo.height, vinfo.width);
  screensize = finfo.line_length * vinfo.yres;
  start = mmap(NULL, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  if ((void *)start == MAP_FAILED) {
    fprintf(stderr, "mmap failed: %s\n", strerror(errno));
    return -1;
  }
  for (x = 0; x < vinfo.xres; x++) {
    pos = x * 4 + 10 * finfo.line_length;
    start[pos] = 0xff;
    start[pos + 1] = 0x00;
    start[pos + 2] = 0xff;
    start[pos + 3] = 0x00;
  }
  if (munmap(start, screensize) < 0) {
    fprintf(stderr, "munmap failed: %s\n", strerror(errno));
    return -1;
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe60(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2e29(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1213 <main+0x93>
mov    0x2df6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0xa4(%rbp),%edi
mov    -0xa0(%rbp),%rdx
mov    %rax,%rcx
lea    0xe07(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x14(%rbp),%edi
mov    0x2dab(%rip),%rax
mov    (%rax),%esi
lea    -0x48(%rbp),%rdx
call   1040 <ioctl@plt>
cmp    $0x0,%rax
jge    1272 <main+0xf2>
mov    0x2d87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa8(%rbp)
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0xa8(%rbp),%edi
mov    %rax,%rdx
lea    0xdbe(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d7 <main+0x357>
mov    -0x14(%rbp),%edi
mov    0x2d24(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rdx
call   1040 <ioctl@plt>
cmp    $0x0,%rax
jge    12d1 <main+0x151>
mov    0x2d28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0xac(%rbp),%edi
mov    %rax,%rdx
lea    0xd88(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d7 <main+0x357>
mov    0x2cd0(%rip),%rax
mov    (%rax),%edi
mov    -0x70(%rbp),%edx
mov    -0x6c(%rbp),%ecx
lea    0xd86(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%edi
mov    -0x68(%rbp),%edx
mov    -0x64(%rbp),%ecx
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%edx
mov    -0x5c(%rbp),%ecx
lea    0xd86(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2c79(%rip),%rax
mov    (%rax),%edi
mov    -0x58(%rbp),%edx
mov    -0x54(%rbp),%ecx
lea    0xd8b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rax
movslq -0x6c(%rbp),%rcx
imul   %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rsi
mov    0x2c98(%rip),%rax
mov    (%rax),%edx
mov    0x2c47(%rip),%rax
or     (%rax),%edx
mov    0x2c76(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
mov    0x2bff(%rip),%rcx
cmp    (%rcx),%rax
jne    13e2 <main+0x262>
mov    0x2c17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xb0(%rbp)
mov    0x2c00(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0xb0(%rbp),%edi
mov    %rax,%rdx
lea    0xd16(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d7 <main+0x357>
movq   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%rax
movslq -0x70(%rbp),%rcx
cmp    %rcx,%rax
jae    146e <main+0x2ee>
mov    -0x90(%rbp),%rax
shl    $0x2,%rax
imul   $0xa,-0x28(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x80(%rbp)
mov    -0x88(%rbp),%rax
mov    -0x80(%rbp),%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x88(%rbp),%rax
mov    -0x80(%rbp),%rcx
movb   $0x0,0x1(%rax,%rcx,1)
mov    -0x88(%rbp),%rax
mov    -0x80(%rbp),%rcx
movb   $0xff,0x2(%rax,%rcx,1)
mov    -0x88(%rbp),%rax
mov    -0x80(%rbp),%rcx
movb   $0x0,0x3(%rax,%rcx,1)
mov    -0x90(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
jmp    13ed <main+0x26d>
mov    -0x88(%rbp),%rdi
mov    -0x78(%rbp),%rsi
call   1070 <munmap@plt>
cmp    $0x0,%rax
jge    14c8 <main+0x348>
mov    0x2b31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xb4(%rbp)
mov    0x2b1a(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0xb4(%rbp),%edi
mov    %rax,%rdx
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d7 <main+0x357>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    0x2e4a(%rip),%rax
mov    (%rax),%esi
lea    0xe69(%rip),%rdi
call   1080 <open@plt>
test   %eax,%eax
js     1377 <main+0x1f7>
mov    %eax,%ebx
mov    0x2e1b(%rip),%rax
mov    (%rax),%esi
lea    0x30(%rsp),%rdx
mov    %ebx,%edi
call   1040 <ioctl@plt>
test   %rax,%rax
js     12e0 <main+0x160>
mov    0x2dd5(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1040 <ioctl@plt>
test   %rax,%rax
js     1300 <main+0x180>
mov    0x2dbf(%rip),%r14
mov    (%r14),%edi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xe72(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    0xe72(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
mov    0x18(%rsp),%edx
mov    0x1c(%rsp),%ecx
lea    0xe7a(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
mov    0x20(%rsp),%edx
mov    0x24(%rsp),%ecx
lea    0xe83(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movslq 0xc(%rsp),%r14
imul   0x50(%rsp),%r14
mov    0x2d99(%rip),%rax
mov    0x2d4a(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2d77(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r14,%rsi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    0x2d0e(%rip),%rcx
cmp    (%rcx),%rax
je     1320 <main+0x1a0>
cmpl   $0x0,0x8(%rsp)
je     12c2 <main+0x142>
xor    %ecx,%ecx
nopl   0x0(%rax)
mov    0x50(%rsp),%rdx
lea    (%rdx,%rdx,4),%rdx
lea    (%rax,%rdx,2),%rdx
movl   $0xff00ff,(%rdx,%rcx,4)
add    $0x1,%rcx
movslq 0x8(%rsp),%rdx
cmp    %rdx,%rcx
jb     12a0 <main+0x120>
mov    %rax,%rdi
mov    %r14,%rsi
call   1070 <munmap@plt>
test   %rax,%rax
js     1340 <main+0x1c0>
mov    %ebx,%edi
call   1050 <close@plt>
xor    %eax,%eax
jmp    136f <main+0x1ef>
mov    0x2cd9(%rip),%rax
mov    (%rax),%ebx
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xd1f(%rip),%rsi
jmp    135e <main+0x1de>
mov    0x2cb9(%rip),%rax
mov    (%rax),%ebx
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xd28(%rip),%rsi
jmp    135e <main+0x1de>
mov    0x2c99(%rip),%rax
mov    (%rax),%ebx
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xda7(%rip),%rsi
jmp    135e <main+0x1de>
mov    0x2c79(%rip),%rax
mov    (%rax),%ebx
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xd98(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2c42(%rip),%rax
mov    (%rax),%ebx
mov    0x2c31(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xc74(%rip),%rsi
lea    0xc64(%rip),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.fb_fix_screeninfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i64 }
%struct.fb_var_screeninfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i64 }
@.str = [9 x i8] c"/dev/fb0\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.1 = [20 x i8] c"open %s failed: %s\0A\00"
@errno = global i32 0
@FBIOGET_FSCREENINFO = global i32 0
@.str.2 = [41 x i8] c"get fixed screen information failed: %s\0A\00"
@FBIOGET_VSCREENINFO = global i32 0
@.str.3 = [39 x i8] c"get var screen information failed: %s\0A\00"
@stdout = global i32 0
@.str.4 = [25 x i8] c"vinfo: xres %u, yres %u\0A\00"
@.str.5 = [33 x i8] c"vinfo: xres_vir %u, yres_vir %u\0A\00"
@.str.6 = [34 x i8] c"vinfo: xoffset %u, yresoffset %u\0A\00"
@.str.7 = [28 x i8] c"vinfo: height %u, width %u\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.8 = [17 x i8] c"mmap failed: %s\0A\00"
@.str.9 = [19 x i8] c"munmap failed: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca %struct.fb_fix_screeninfo
%9 = alloca %struct.fb_var_screeninfo
%10 = alloca i64
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %7
%15 = load i8*, i8** %7
%16 = load i32, i32* @O_RDWR
%17 = call i32 @open(i8* %15, i32 %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %7
%23 = load i32, i32* @errno
%24 = call i8* @strerror(i32 %23)
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %24)
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = load i32, i32* %6
%29 = load i32, i32* @FBIOGET_FSCREENINFO
%30 = bitcast %struct.fb_fix_screeninfo* %8 to %struct.fb_var_screeninfo*
%31 = call i64 @ioctl(i32 %28, i32 %29, %struct.fb_var_screeninfo* %30)
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %27
%34 = load i32, i32* @stderr
%35 = load i32, i32* @errno
%36 = call i8* @strerror(i32 %35)
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %36)
store i32 -1, i32* %3
br label %139
38: ; preds = %27
%39 = load i32, i32* %6
%40 = load i32, i32* @FBIOGET_VSCREENINFO
%41 = call i64 @ioctl(i32 %39, i32 %40, %struct.fb_var_screeninfo* %9)
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %46)
store i32 -1, i32* %3
br label %139
48: ; preds = %38
%49 = load i32, i32* @stdout
%50 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 0
%51 = load i32, i32* %50
%52 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 1
%53 = load i32, i32* %52
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %51, i32 %53)
%55 = load i32, i32* @stdout
%56 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 2
%57 = load i32, i32* %56
%58 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 3
%59 = load i32, i32* %58
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %57, i32 %59)
%61 = load i32, i32* @stdout
%62 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 4
%63 = load i32, i32* %62
%64 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 5
%65 = load i32, i32* %64
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i32 %63, i32 %65)
%67 = load i32, i32* @stdout
%68 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 6
%69 = load i32, i32* %68
%70 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 7
%71 = load i32, i32* %70
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %69, i32 %71)
%73 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %8, i32 0, i32 8
%74 = load i64, i64* %73
%75 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 1
%76 = load i32, i32* %75
%77 = sext i32 %76 to i64
%78 = mul i64 %74, %77
store i64 %78, i64* %10
%79 = load i64, i64* %10
%80 = load i32, i32* @PROT_READ
%81 = load i32, i32* @PROT_WRITE
%82 = or i32 %80, %81
%83 = load i32, i32* @MAP_SHARED
%84 = load i32, i32* %6
%85 = call i8* @mmap(i32* null, i64 %79, i32 %82, i32 %83, i32 %84, i32 0)
store i8* %85, i8** %12
%86 = load i8*, i8** %12
%87 = load i8*, i8** @MAP_FAILED
%88 = icmp eq i8* %86, %87
br i1 %88, label %89, label %94
89: ; preds = %48
%90 = load i32, i32* @stderr
%91 = load i32, i32* @errno
%92 = call i8* @strerror(i32 %91)
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %92)
store i32 -1, i32* %3
br label %139
94: ; preds = %48
store i64 0, i64* %13
br label %95
95: ; preds = %123, %94
%96 = load i64, i64* %13
%97 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %9, i32 0, i32 0
%98 = load i32, i32* %97
%99 = sext i32 %98 to i64
%100 = icmp ult i64 %96, %99
br i1 %100, label %101, label %126
101: ; preds = %95
%102 = load i64, i64* %13
%103 = mul i64 %102, 4
%104 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %8, i32 0, i32 8
%105 = load i64, i64* %104
%106 = mul i64 10, %105
%107 = add i64 %103, %106
store i64 %107, i64* %11
%108 = load i8*, i8** %12
%109 = load i64, i64* %11
%110 = getelementptr inbounds i8, i8* %108, i64 %109
store i8 -1, i8* %110
%111 = load i8*, i8** %12
%112 = load i64, i64* %11
%113 = add i64 %112, 1
%114 = getelementptr inbounds i8, i8* %111, i64 %113
store i8 0, i8* %114
%115 = load i8*, i8** %12
%116 = load i64, i64* %11
%117 = add i64 %116, 2
%118 = getelementptr inbounds i8, i8* %115, i64 %117
store i8 -1, i8* %118
%119 = load i8*, i8** %12
%120 = load i64, i64* %11
%121 = add i64 %120, 3
%122 = getelementptr inbounds i8, i8* %119, i64 %121
store i8 0, i8* %122
br label %123
123: ; preds = %101
%124 = load i64, i64* %13
%125 = add i64 %124, 1
store i64 %125, i64* %13
br label %95
126: ; preds = %95
%127 = load i8*, i8** %12
%128 = load i64, i64* %10
%129 = call i64 @munmap(i8* %127, i64 %128)
%130 = icmp slt i64 %129, 0
br i1 %130, label %131, label %136
131: ; preds = %126
%132 = load i32, i32* @stderr
%133 = load i32, i32* @errno
%134 = call i8* @strerror(i32 %133)
%135 = call i32 (i32, i8*, ...) @fprintf(i32 %132, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* %134)
store i32 -1, i32* %3
br label %139
136: ; preds = %126
%137 = load i32, i32* %6
%138 = call i32 @close(i32 %137)
store i32 0, i32* %3
br label %139
139: ; preds = %136, %131, %89, %43, %33
%140 = load i32, i32* %3
ret i32 %140
}

LLVM IR (-O2):
%struct.fb_fix_screeninfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i64 }
%struct.fb_var_screeninfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i64 }
@.str = [9 x i8] c"/dev/fb0\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.1 = [20 x i8] c"open %s failed: %s\0A\00"
@errno = global i32 0
@FBIOGET_FSCREENINFO = global i32 0
@.str.2 = [41 x i8] c"get fixed screen information failed: %s\0A\00"
@FBIOGET_VSCREENINFO = global i32 0
@.str.3 = [39 x i8] c"get var screen information failed: %s\0A\00"
@stdout = global i32 0
@.str.4 = [25 x i8] c"vinfo: xres %u, yres %u\0A\00"
@.str.5 = [33 x i8] c"vinfo: xres_vir %u, yres_vir %u\0A\00"
@.str.6 = [34 x i8] c"vinfo: xoffset %u, yresoffset %u\0A\00"
@.str.7 = [28 x i8] c"vinfo: height %u, width %u\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.8 = [17 x i8] c"mmap failed: %s\0A\00"
@.str.9 = [19 x i8] c"munmap failed: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.fb_fix_screeninfo
%4 = alloca %struct.fb_var_screeninfo
%5 = bitcast %struct.fb_fix_screeninfo* %3 to i8*
%6 = bitcast %struct.fb_var_screeninfo* %4 to i8*
%7 = load i32, i32* @O_RDWR
%8 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i32, i32* @errno
%13 = tail call i8* @strerror(i32 %12)
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i32, i32* @FBIOGET_FSCREENINFO
%18 = bitcast %struct.fb_fix_screeninfo* %3 to %struct.fb_var_screeninfo*
%19 = call i64 @ioctl(i32 %8, i32 %17, %struct.fb_var_screeninfo* %18)
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = load i32, i32* @stderr
%23 = load i32, i32* @errno
%24 = call i8* @strerror(i32 %23)
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %107
26: ; preds = %16
%27 = load i32, i32* @FBIOGET_VSCREENINFO
%28 = call i64 @ioctl(i32 %8, i32 %27, %struct.fb_var_screeninfo* %4)
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %26
%31 = load i32, i32* @stderr
%32 = load i32, i32* @errno
%33 = call i8* @strerror(i32 %32)
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %33)
br label %107
35: ; preds = %26
%36 = load i32, i32* @stdout
%37 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i64 0, i32 0
%38 = load i32, i32* %37
%39 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i64 0, i32 1
%40 = load i32, i32* %39
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %38, i32 %40)
%42 = load i32, i32* @stdout
%43 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i64 0, i32 2
%44 = load i32, i32* %43
%45 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i64 0, i32 3
%46 = load i32, i32* %45
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %44, i32 %46)
%48 = load i32, i32* @stdout
%49 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i64 0, i32 4
%50 = load i32, i32* %49
%51 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i64 0, i32 5
%52 = load i32, i32* %51
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i32 %50, i32 %52)
%54 = load i32, i32* @stdout
%55 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i64 0, i32 6
%56 = load i32, i32* %55
%57 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i64 0, i32 7
%58 = load i32, i32* %57
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %56, i32 %58)
%60 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %3, i64 0, i32 8
%61 = load i64, i64* %60
%62 = load i32, i32* %39
%63 = sext i32 %62 to i64
%64 = mul i64 %61, %63
%65 = load i32, i32* @PROT_READ
%66 = load i32, i32* @PROT_WRITE
%67 = or i32 %66, %65
%68 = load i32, i32* @MAP_SHARED
%69 = call i8* @mmap(i32* null, i64 %64, i32 %67, i32 %68, i32 %8, i32 0)
%70 = load i8*, i8** @MAP_FAILED
%71 = icmp eq i8* %69, %70
br i1 %71, label %75, label %72
72: ; preds = %35
%73 = load i32, i32* %37
%74 = icmp eq i32 %73, 0
br i1 %74, label %97, label %80
75: ; preds = %35
%76 = load i32, i32* @stderr
%77 = load i32, i32* @errno
%78 = call i8* @strerror(i32 %77)
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %78)
br label %107
80: ; preds = %72, %80
%81 = phi i64 [ %93, %80 ], [ 0, %72 ]
%82 = shl i64 %81, 2
%83 = load i64, i64* %60
%84 = mul i64 %83, 10
%85 = add i64 %84, %82
%86 = getelementptr inbounds i8, i8* %69, i64 %85
store i8 -1, i8* %86
%87 = or i64 %85, 1
%88 = getelementptr inbounds i8, i8* %69, i64 %87
store i8 0, i8* %88
%89 = add i64 %85, 2
%90 = getelementptr inbounds i8, i8* %69, i64 %89
store i8 -1, i8* %90
%91 = add i64 %85, 3
%92 = getelementptr inbounds i8, i8* %69, i64 %91
store i8 0, i8* %92
%93 = add nuw i64 %81, 1
%94 = load i32, i32* %37
%95 = sext i32 %94 to i64
%96 = icmp ult i64 %93, %95
br i1 %96, label %80, label %97
97: ; preds = %80, %72
%98 = call i64 @munmap(i8* %69, i64 %64)
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %105
100: ; preds = %97
%101 = load i32, i32* @stderr
%102 = load i32, i32* @errno
%103 = call i8* @strerror(i32 %102)
%104 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* %103)
br label %107
105: ; preds = %97
%106 = call i32 @close(i32 %8)
br label %107
107: ; preds = %105, %100, %75, %30, %21
%108 = phi i32 [ -1, %21 ], [ -1, %30 ], [ -1, %75 ], [ -1, %100 ], [ 0, %105 ]
ret i32 %108
}