#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 bits_per_pixel;
  unsigned int line_length;
};
struct fb_fix_screeninfo {
  int xres;
  int yres;
  int bits_per_pixel;
  unsigned int line_length;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ FBIOGET_FSCREENINFO;
int /*<<< orphan*/ FBIOGET_VSCREENINFO;
int /*<<< orphan*/ FBIOPUT_VSCREENINFO;
void *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct fb_var_screeninfo *);
int /*<<< orphan*/ memcpy(struct fb_var_screeninfo *,
                          struct fb_var_screeninfo *, int);
scalar_t__ mmap(int /*<<< orphan*/, long, int, int /*<<< orphan*/, int,
                int /*<<< orphan*/);
int /*<<< orphan*/ munmap(char *, long);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int main(void) {
  int fbfd = 0;
  struct fb_var_screeninfo orig_vinfo;
  struct fb_var_screeninfo vinfo;
  struct fb_fix_screeninfo finfo;
  long int screensize = 0;
  char *fbp = 0;
  fbfd = open("/dev/fb0", O_RDWR);
  if (!fbfd) {
    printf("Error: cannot open framebuffer device.\n");
    exit(EXIT_FAILURE);
  }
  printf("The framebuffer device was opened successfully.\n");
  if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo))
    printf("Error reading variable information.\n");
  printf("Original %dx%d, %dbpp\n", vinfo.xres, vinfo.yres,
         vinfo.bits_per_pixel);
  memcpy(&orig_vinfo, &vinfo, sizeof(struct fb_var_screeninfo));
  vinfo.bits_per_pixel = 16;
  if (ioctl(fbfd, FBIOPUT_VSCREENINFO, &vinfo))
    printf("Error setting variable information.\n");
  if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo))
    printf("Error reading fixed information.\n");
  screensize = vinfo.xres * vinfo.yres;
  fbp =
      (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
  if ((void *)fbp == MAP_FAILED) {
    printf("Failed to mmap.\n");
    exit(EXIT_FAILURE);
  } else {
    unsigned int x, y;
    unsigned int pix_offset;
    for (y = 0; y < (vinfo.yres / 2); y++) {
      for (x = 0; x < vinfo.xres; x++) {
        pix_offset = x + y * finfo.line_length;
        *((char *)(fbp + pix_offset)) = 16 * x / vinfo.xres;
      }
    }
    sleep(5);
  }
  munmap(fbp, screensize);
  if (ioctl(fbfd, FBIOPUT_VSCREENINFO, &orig_vinfo)) {
    printf("Error re-setting variable information.\n");
    exit(EXIT_FAILURE);
  }
  close(fbfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    0x2e1b(%rip),%rax
mov    (%rax),%esi
lea    0xe3a(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11f4 <main+0x64>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2d9c(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     122f <main+0x9f>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   1070 <memcpy@plt>
movl   $0x10,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2d67(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     128c <main+0xfc>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2d2a(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     12b9 <main+0x129>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rsi
mov    0x2d27(%rip),%rax
mov    (%rax),%edx
mov    0x2cd6(%rip),%rax
or     (%rax),%edx
mov    0x2d05(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1030 <mmap@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    0x2c9d(%rip),%rcx
cmp    (%rcx),%rax
jne    1328 <main+0x198>
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c97(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
cmp    %ecx,%eax
jae    13a7 <main+0x217>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jae    1394 <main+0x204>
mov    -0x4c(%rbp),%eax
mov    -0x50(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x54(%rbp)
mov    -0x4c(%rbp),%eax
shl    $0x4,%eax
xor    %edx,%edx
divl   -0x28(%rbp)
mov    %al,%dl
mov    -0x48(%rbp),%rax
mov    -0x54(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1354 <main+0x1c4>
jmp    1399 <main+0x209>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    132f <main+0x19f>
mov    $0x5,%edi
call   10b0 <sleep@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1080 <munmap@plt>
mov    -0x8(%rbp),%edi
mov    0x2c08(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     13f9 <main+0x269>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2bc6(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    0x2e23(%rip),%rax
mov    (%rax),%esi
lea    0xe42(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
je     137a <main+0x1da>
mov    %eax,%r14d
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %r14d,%edi
call   1060 <ioctl@plt>
test   %rax,%rax
je     1201 <main+0x61>
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
lea    0xdf5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x28(%rsp),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x10,%edx
call   1080 <memcpy@plt>
movl   $0x10,0x10(%rsp)
mov    0x2d8f(%rip),%r15
mov    (%r15),%esi
mov    %r14d,%edi
mov    %rbx,%rdx
call   1060 <ioctl@plt>
test   %rax,%rax
je     1260 <main+0xc0>
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d59(%rip),%rax
mov    (%rax),%esi
lea    0x18(%rsp),%rdx
mov    %r14d,%edi
call   1060 <ioctl@plt>
test   %rax,%rax
je     1287 <main+0xe7>
lea    0xe2c(%rip),%rdi
call   1030 <puts@plt>
movslq 0x8(%rsp),%rax
movslq 0xc(%rsp),%r12
imul   %rax,%r12
mov    0x2d5c(%rip),%rax
mov    0x2d0d(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2d3a(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r12,%rsi
mov    %r14d,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%r13
mov    0x2cd6(%rip),%rax
cmp    %r13,(%rax)
je     1383 <main+0x1e3>
mov    0xc(%rsp),%eax
lea    0x1(%rax),%ecx
cmp    $0x3,%ecx
jae    1326 <main+0x186>
mov    $0x5,%edi
call   10c0 <sleep@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1090 <munmap@plt>
mov    (%r15),%esi
lea    0x28(%rsp),%rdx
mov    %r14d,%edi
call   1060 <ioctl@plt>
test   %rax,%rax
jne    138c <main+0x1ec>
mov    %r14d,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %esi,%esi
mov    0x8(%rsp),%edi
jmp    1342 <main+0x1a2>
xchg   %ax,%ax
add    $0x1,%esi
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
mov    %ecx,%edi
cmp    %edx,%esi
jae    12df <main+0x13f>
mov    $0x0,%ecx
test   %edi,%edi
je     1330 <main+0x190>
xor    %ecx,%ecx
xor    %ebx,%ebx
nop
mov    0x24(%rsp),%ebp
imul   %esi,%ebp
add    %ebx,%ebp
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
mov    %al,0x0(%r13,%rbp,1)
add    $0x1,%ebx
mov    0x8(%rsp),%edi
add    $0x10,%ecx
cmp    %edi,%ebx
jb     1350 <main+0x1b0>
mov    0xc(%rsp),%eax
mov    %edi,%ecx
jmp    1330 <main+0x190>
lea    0xc9f(%rip),%rdi
jmp    1393 <main+0x1f3>
lea    0xd14(%rip),%rdi
jmp    1393 <main+0x1f3>
lea    0xce4(%rip),%rdi
call   1030 <puts@plt>
mov    0x2c19(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.fb_var_screeninfo = type { i32, i32, i32, i32 }
%struct.fb_fix_screeninfo = type { i32, i32, i32, i32 }
@.str = [9 x i8] c"/dev/fb0\00"
@O_RDWR = global i32 0
@.str.1 = [40 x i8] c"Error: cannot open framebuffer device.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [49 x i8] c"The framebuffer device was opened successfully.\0A\00"
@FBIOGET_VSCREENINFO = global i32 0
@.str.3 = [37 x i8] c"Error reading variable information.\0A\00"
@.str.4 = [23 x i8] c"Original %dx%d, %dbpp\0A\00"
@FBIOPUT_VSCREENINFO = global i32 0
@.str.5 = [37 x i8] c"Error setting variable information.\0A\00"
@FBIOGET_FSCREENINFO = global i32 0
@.str.6 = [34 x i8] c"Error reading fixed information.\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.7 = [17 x i8] c"Failed to mmap.\0A\00"
@.str.8 = [40 x i8] c"Error re-setting variable information.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.fb_var_screeninfo
%4 = alloca %struct.fb_var_screeninfo
%5 = alloca %struct.fb_fix_screeninfo
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i64 0, i64* %6
store i8* null, i8** %7
%11 = load i32, i32* @O_RDWR
%12 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* %2
%22 = load i32, i32* @FBIOGET_VSCREENINFO
%23 = call i64 @ioctl(i32 %21, i32 %22, %struct.fb_var_screeninfo* %4)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %19
%28 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i32 0, i32 0
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i32 0, i32 1
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i32 0, i32 2
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %29, i32 %31, i32 %33)
%35 = call i32 @memcpy(%struct.fb_var_screeninfo* %3, %struct.fb_var_screeninfo* %4, i32 16)
%36 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i32 0, i32 2
store i32 16, i32* %36
%37 = load i32, i32* %2
%38 = load i32, i32* @FBIOPUT_VSCREENINFO
%39 = call i64 @ioctl(i32 %37, i32 %38, %struct.fb_var_screeninfo* %4)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %27
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
br label %43
43: ; preds = %41, %27
%44 = load i32, i32* %2
%45 = load i32, i32* @FBIOGET_FSCREENINFO
%46 = bitcast %struct.fb_fix_screeninfo* %5 to %struct.fb_var_screeninfo*
%47 = call i64 @ioctl(i32 %44, i32 %45, %struct.fb_var_screeninfo* %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %51
51: ; preds = %49, %43
%52 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i32 0, i32 0
%53 = load i32, i32* %52
%54 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i32 0, i32 1
%55 = load i32, i32* %54
%56 = mul nsw i32 %53, %55
%57 = sext i32 %56 to i64
store i64 %57, i64* %6
%58 = load i64, i64* %6
%59 = load i32, i32* @PROT_READ
%60 = load i32, i32* @PROT_WRITE
%61 = or i32 %59, %60
%62 = load i32, i32* @MAP_SHARED
%63 = load i32, i32* %2
%64 = call i64 @mmap(i32 0, i64 %58, i32 %61, i32 %62, i32 %63, i32 0)
%65 = inttoptr i64 %64 to i8*
store i8* %65, i8** %7
%66 = load i8*, i8** %7
%67 = load i8*, i8** @MAP_FAILED
%68 = icmp eq i8* %66, %67
br i1 %68, label %69, label %73
69: ; preds = %51
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%71 = load i32, i32* @EXIT_FAILURE
%72 = call i32 @exit(i32 %71)
unreachable
73: ; preds = %51
store i32 0, i32* %9
br label %74
74: ; preds = %107, %73
%75 = load i32, i32* %9
%76 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i32 0, i32 1
%77 = load i32, i32* %76
%78 = sdiv i32 %77, 2
%79 = icmp ult i32 %75, %78
br i1 %79, label %80, label %110
80: ; preds = %74
store i32 0, i32* %8
br label %81
81: ; preds = %103, %80
%82 = load i32, i32* %8
%83 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i32 0, i32 0
%84 = load i32, i32* %83
%85 = icmp ult i32 %82, %84
br i1 %85, label %86, label %106
86: ; preds = %81
%87 = load i32, i32* %8
%88 = load i32, i32* %9
%89 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %5, i32 0, i32 3
%90 = load i32, i32* %89
%91 = mul i32 %88, %90
%92 = add i32 %87, %91
store i32 %92, i32* %10
%93 = load i32, i32* %8
%94 = mul i32 16, %93
%95 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %4, i32 0, i32 0
%96 = load i32, i32* %95
%97 = udiv i32 %94, %96
%98 = trunc i32 %97 to i8
%99 = load i8*, i8** %7
%100 = load i32, i32* %10
%101 = zext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %99, i64 %101
store i8 %98, i8* %102
br label %103
103: ; preds = %86
%104 = load i32, i32* %8
%105 = add i32 %104, 1
store i32 %105, i32* %8
br label %81
106: ; preds = %81
br label %107
107: ; preds = %106
%108 = load i32, i32* %9
%109 = add i32 %108, 1
store i32 %109, i32* %9
br label %74
110: ; preds = %74
%111 = call i32 @sleep(i32 5)
br label %112
112: ; preds = %110
%113 = load i8*, i8** %7
%114 = load i64, i64* %6
%115 = call i32 @munmap(i8* %113, i64 %114)
%116 = load i32, i32* %2
%117 = load i32, i32* @FBIOPUT_VSCREENINFO
%118 = call i64 @ioctl(i32 %116, i32 %117, %struct.fb_var_screeninfo* %3)
%119 = icmp ne i64 %118, 0
br i1 %119, label %120, label %124
120: ; preds = %112
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%122 = load i32, i32* @EXIT_FAILURE
%123 = call i32 @exit(i32 %122)
unreachable
124: ; preds = %112
%125 = load i32, i32* %2
%126 = call i32 @close(i32 %125)
ret i32 0
}

LLVM IR (-O2):
%struct.fb_var_screeninfo = type { i32, i32, i32, i32 }
%struct.fb_fix_screeninfo = type { i32, i32, i32, i32 }
@.str = [9 x i8] c"/dev/fb0\00"
@O_RDWR = global i32 0
@EXIT_FAILURE = global i32 0
@FBIOGET_VSCREENINFO = global i32 0
@.str.4 = [23 x i8] c"Original %dx%d, %dbpp\0A\00"
@FBIOPUT_VSCREENINFO = global i32 0
@FBIOGET_FSCREENINFO = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@str = [39 x i8] c"Error: cannot open framebuffer device.\00"
@str.9 = [48 x i8] c"The framebuffer device was opened successfully.\00"
@str.10 = [39 x i8] c"Error re-setting variable information.\00"
@str.11 = [16 x i8] c"Failed to mmap.\00"
@str.12 = [33 x i8] c"Error reading fixed information.\00"
@str.13 = [36 x i8] c"Error setting variable information.\00"
@str.14 = [36 x i8] c"Error reading variable information.\00"
define i32 @main() {
%1 = alloca %struct.fb_var_screeninfo
%2 = alloca %struct.fb_var_screeninfo
%3 = alloca %struct.fb_fix_screeninfo
%4 = bitcast %struct.fb_var_screeninfo* %1 to i8*
%5 = bitcast %struct.fb_var_screeninfo* %2 to i8*
%6 = bitcast %struct.fb_fix_screeninfo* %3 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 eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %0
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.9, i64 0, i64 0))
%16 = load i32, i32* @FBIOGET_VSCREENINFO
%17 = call i64 @ioctl(i32 %8, i32 %16, %struct.fb_var_screeninfo* %2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %14
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.14, i64 0, i64 0))
br label %21
21: ; preds = %19, %14
%22 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 0
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 1
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 2
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %23, i32 %25, i32 %27)
%29 = call i32 @memcpy(%struct.fb_var_screeninfo* %1, %struct.fb_var_screeninfo* %2, i32 16)
store i32 16, i32* %26
%30 = load i32, i32* @FBIOPUT_VSCREENINFO
%31 = call i64 @ioctl(i32 %8, i32 %30, %struct.fb_var_screeninfo* %2)
%32 = icmp eq i64 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %21
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.13, i64 0, i64 0))
br label %35
35: ; preds = %33, %21
%36 = load i32, i32* @FBIOGET_FSCREENINFO
%37 = bitcast %struct.fb_fix_screeninfo* %3 to %struct.fb_var_screeninfo*
%38 = call i64 @ioctl(i32 %8, i32 %36, %struct.fb_var_screeninfo* %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %35
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
br label %42
42: ; preds = %40, %35
%43 = load i32, i32* %22
%44 = load i32, i32* %24
%45 = mul nsw i32 %44, %43
%46 = sext i32 %45 to i64
%47 = load i32, i32* @PROT_READ
%48 = load i32, i32* @PROT_WRITE
%49 = or i32 %48, %47
%50 = load i32, i32* @MAP_SHARED
%51 = call i64 @mmap(i32 0, i64 %46, i32 %49, i32 %50, i32 %8, i32 0)
%52 = inttoptr i64 %51 to i8*
%53 = load i8*, i8** @MAP_FAILED
%54 = icmp eq i8* %53, %52
br i1 %54, label %62, label %55
55: ; preds = %42
%56 = load i32, i32* %24
%57 = add i32 %56, 1
%58 = icmp ult i32 %57, 3
br i1 %58, label %93, label %59
59: ; preds = %55
%60 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %3, i64 0, i32 3
%61 = load i32, i32* %22
br label %66
62: ; preds = %42
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.11, i64 0, i64 0))
%64 = load i32, i32* @EXIT_FAILURE
%65 = call i32 @exit(i32 %64)
unreachable
66: ; preds = %59, %87
%67 = phi i32 [ %56, %59 ], [ %88, %87 ]
%68 = phi i32 [ %61, %59 ], [ %89, %87 ]
%69 = phi i32 [ 0, %59 ], [ %90, %87 ]
%70 = icmp eq i32 %68, 0
br i1 %70, label %87, label %71
71: ; preds = %66, %71
%72 = phi i32 [ %83, %71 ], [ %68, %66 ]
%73 = phi i32 [ %82, %71 ], [ 0, %66 ]
%74 = load i32, i32* %60
%75 = mul i32 %74, %69
%76 = add i32 %75, %73
%77 = shl i32 %73, 4
%78 = udiv i32 %77, %72
%79 = trunc i32 %78 to i8
%80 = zext i32 %76 to i64
%81 = getelementptr inbounds i8, i8* %52, i64 %80
store i8 %79, i8* %81
%82 = add nuw i32 %73, 1
%83 = load i32, i32* %22
%84 = icmp ult i32 %82, %83
br i1 %84, label %71, label %85
85: ; preds = %71
%86 = load i32, i32* %24
br label %87
87: ; preds = %85, %66
%88 = phi i32 [ %86, %85 ], [ %67, %66 ]
%89 = phi i32 [ %83, %85 ], [ 0, %66 ]
%90 = add nuw i32 %69, 1
%91 = sdiv i32 %88, 2
%92 = icmp ult i32 %90, %91
br i1 %92, label %66, label %93
93: ; preds = %87, %55
%94 = call i32 @sleep(i32 5)
%95 = call i32 @munmap(i8* %52, i64 %46)
%96 = load i32, i32* @FBIOPUT_VSCREENINFO
%97 = call i64 @ioctl(i32 %8, i32 %96, %struct.fb_var_screeninfo* %1)
%98 = icmp eq i64 %97, 0
br i1 %98, label %103, label %99
99: ; preds = %93
%100 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.10, i64 0, i64 0))
%101 = load i32, i32* @EXIT_FAILURE
%102 = call i32 @exit(i32 %101)
unreachable
103: ; preds = %93
%104 = call i32 @close(i32 %8)
ret i32 0
}