#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 smem_len;
  int line_length;
  int xres;
  int yres;
  int xres_virtual;
  int yres_virtual;
  int xoffset;
  int yoffset;
  int bits_per_pixel;
  int /*<<< orphan*/ smem_start;
};
struct fb_fix_screeninfo {
  int smem_len;
  int line_length;
  int xres;
  int yres;
  int xres_virtual;
  int yres_virtual;
  int xoffset;
  int yoffset;
  int bits_per_pixel;
  int /*<<< orphan*/ smem_start;
};

/* Variables and functions */
int /*<<< orphan*/ FBIOGET_FSCREENINFO;
int /*<<< orphan*/ FBIOGET_VSCREENINFO;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ getchar();
scalar_t__ ioctl(int, int /*<<< orphan*/, struct fb_var_screeninfo *);
scalar_t__ mmap(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/, int,
                int /*<<< orphan*/);
int /*<<< orphan*/ munmap(unsigned char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int fb;
  unsigned int x, y, fbl;
  unsigned char *fbm;
  struct fb_fix_screeninfo fbfsi;
  struct fb_var_screeninfo fbvsi;
  fb = open("/dev/fb0", O_RDWR);
  if (fb > 0) {
    if (ioctl(fb, FBIOGET_FSCREENINFO, &fbfsi) == 0) {
      printf("smem_start: %#lx\n", fbfsi.smem_start);
      printf("smem_len: %d\n", fbfsi.smem_len);
      printf("line_length: %d\n", fbfsi.line_length);
    } else {
      printf("AAAAGGH! NO PUDE ABRIR!!!\n");
      exit(1);
    }
    if (ioctl(fb, FBIOGET_VSCREENINFO, &fbvsi) == 0) {
      printf("xres: %d\n", fbvsi.xres);
      printf("yres: %d\n", fbvsi.yres);
      printf("xres_virtual: %d\n", fbvsi.xres_virtual);
      printf("yres_virtual: %d\n", fbvsi.yres_virtual);
      printf("xoffset: %d\n", fbvsi.xoffset);
      printf("yoffset: %d\n", fbvsi.yoffset);
      printf("bits_per_pixel: %d\n", fbvsi.bits_per_pixel);
    } else {
      printf("AAAAGGH! NO PUDE ABRIR!!!\n");
      exit(1);
    }
  } else {
    printf("AAAAGGH! NO PUDE ABRIR!!!\n");
    exit(1);
  }
  fbm = (unsigned char *)mmap(NULL, fbfsi.smem_len, PROT_READ | PROT_WRITE,
                              MAP_SHARED, fb, 0);
  for (y = 0; y < fbvsi.yres / 4; y++) {
    for (x = 0; x < fbvsi.xres / 4; x++) {
      fbl = (x + fbvsi.xoffset) * (fbvsi.bits_per_pixel / 8) +
            (y + fbvsi.yoffset) * fbfsi.line_length;
      *(fbm + fbl + 0) = 0xff;
      *(fbm + fbl + 1) = 0xff;
      *(fbm + fbl + 2) = 0xff;
      *(fbm + fbl + 3) = 0x00;
    }
  }
  getchar();
  munmap(fbm, fbfsi.smem_len);
  close(fb);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e3f(%rip),%rax
mov    (%rax),%esi
lea    0xe5e(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    12db <main+0x15b>
mov    -0x8(%rbp),%edi
mov    0x2e0a(%rip),%rax
mov    (%rax),%esi
lea    -0x48(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jne    120b <main+0x8b>
mov    -0x24(%rbp),%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1223 <main+0xa3>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%edi
mov    0x2d8b(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jne    12be <main+0x13e>
mov    -0x68(%rbp),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%esi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x5c(%rbp),%esi
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x58(%rbp),%esi
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x54(%rbp),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x50(%rbp),%esi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d6 <main+0x156>
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    12f3 <main+0x173>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x48(%rbp),%esi
mov    0x2cfb(%rip),%rax
mov    (%rax),%edx
mov    0x2cba(%rip),%rax
or     (%rax),%edx
mov    0x2cd9(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x64(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
cmp    %ecx,%eax
jae    13ea <main+0x26a>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x68(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x78(%rbp),%eax
cmp    %ecx,%eax
jae    13d7 <main+0x257>
mov    -0xc(%rbp),%eax
add    -0x58(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x50(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
imul   %ecx,%eax
mov    -0x10(%rbp),%ecx
add    -0x54(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
movb   $0xff,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
movb   $0xff,0x1(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
movb   $0xff,0x2(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
movb   $0x0,0x3(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1351 <main+0x1d1>
jmp    13dc <main+0x25c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    132c <main+0x1ac>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    -0x20(%rbp),%rdi
mov    -0x48(%rbp),%esi
call   1080 <munmap@plt>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    0x2e39(%rip),%rax
mov    (%rax),%esi
lea    0xe58(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
jle    1388 <main+0x1f8>
mov    %eax,%r14d
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
lea    0x28(%rsp),%rdx
mov    %r14d,%edi
call   1060 <ioctl@plt>
test   %rax,%rax
jne    1388 <main+0x1f8>
mov    0x4c(%rsp),%esi
lea    0xe27(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%esi
lea    0xe27(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c(%rsp),%esi
lea    0xe23(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %r14d,%edi
call   1060 <ioctl@plt>
test   %rax,%rax
jne    1388 <main+0x1f8>
mov    0x8(%rsp),%esi
lea    0xe05(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xde9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%esi
mov    0x2d43(%rip),%rax
mov    0x2d04(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2d21(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r14d,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%ecx
lea    0x3(%rcx),%eax
cmp    $0x7,%eax
jae    130b <main+0x17b>
xor    %eax,%eax
call   1080 <getchar@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
call   1090 <munmap@plt>
mov    %r14d,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x8(%rsp),%eax
jmp    1332 <main+0x1a2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
lea    0x3(%rcx),%edx
test   %ecx,%ecx
cmovns %ecx,%edx
sar    $0x2,%edx
cmp    %edx,%ebp
jae    12e5 <main+0x155>
lea    0x3(%rax),%edx
cmp    $0x7,%edx
jb     1320 <main+0x190>
xor    %ecx,%ecx
nopl   0x0(%rax)
mov    0x18(%rsp),%eax
add    %ecx,%eax
mov    0x20(%rsp),%edx
lea    0x7(%rdx),%esi
test   %edx,%edx
cmovns %edx,%esi
sar    $0x3,%esi
imul   %eax,%esi
mov    0x1c(%rsp),%eax
add    %ebp,%eax
imul   0x2c(%rsp),%eax
add    %esi,%eax
movl   $0xffffff,(%rbx,%rax,1)
add    $0x1,%ecx
mov    0x8(%rsp),%eax
lea    0x3(%rax),%edx
test   %eax,%eax
cmovns %eax,%edx
sar    $0x2,%edx
cmp    %edx,%ecx
jb     1340 <main+0x1b0>
mov    0xc(%rsp),%ecx
jmp    1320 <main+0x190>
lea    0xd11(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

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

LLVM IR (-O2):
%struct.fb_fix_screeninfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.fb_var_screeninfo = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [9 x i8] c"/dev/fb0\00"
@O_RDWR = global i32 0
@FBIOGET_FSCREENINFO = global i32 0
@.str.1 = [18 x i8] c"smem_start: %#lx\0A\00"
@.str.2 = [14 x i8] c"smem_len: %d\0A\00"
@.str.3 = [17 x i8] c"line_length: %d\0A\00"
@FBIOGET_VSCREENINFO = global i32 0
@.str.5 = [10 x i8] c"xres: %d\0A\00"
@.str.6 = [10 x i8] c"yres: %d\0A\00"
@.str.7 = [18 x i8] c"xres_virtual: %d\0A\00"
@.str.8 = [18 x i8] c"yres_virtual: %d\0A\00"
@.str.9 = [13 x i8] c"xoffset: %d\0A\00"
@.str.10 = [13 x i8] c"yoffset: %d\0A\00"
@.str.11 = [20 x i8] c"bits_per_pixel: %d\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@str.13 = [26 x i8] c"AAAAGGH! NO PUDE ABRIR!!!\00"
define i32 @main() {
%1 = alloca %struct.fb_fix_screeninfo
%2 = alloca %struct.fb_var_screeninfo
%3 = bitcast %struct.fb_fix_screeninfo* %1 to i8*
%4 = bitcast %struct.fb_var_screeninfo* %2 to i8*
%5 = load i32, i32* @O_RDWR
%6 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %66
8: ; preds = %0
%9 = load i32, i32* @FBIOGET_FSCREENINFO
%10 = bitcast %struct.fb_fix_screeninfo* %1 to %struct.fb_var_screeninfo*
%11 = call i64 @ioctl(i32 %6, i32 %9, %struct.fb_var_screeninfo* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %8
%14 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %1, i64 0, i32 9
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %1, i64 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %1, i64 0, i32 1
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @FBIOGET_VSCREENINFO
%24 = call i64 @ioctl(i32 %6, i32 %23, %struct.fb_var_screeninfo* %2)
%25 = icmp eq i64 %24, 0
br i1 %25, label %29, label %63
26: ; preds = %8
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.13, i64 0, i64 0))
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %13
%30 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 2
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 3
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 4
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 5
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 6
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 7
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %2, i64 0, i32 8
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %17
%52 = load i32, i32* @PROT_READ
%53 = load i32, i32* @PROT_WRITE
%54 = or i32 %53, %52
%55 = load i32, i32* @MAP_SHARED
%56 = call i64 @mmap(i32* null, i32 %51, i32 %54, i32 %55, i32 %6, i32 0)
%57 = inttoptr i64 %56 to i8*
%58 = load i32, i32* %33
%59 = add i32 %58, 3
%60 = icmp ult i32 %59, 7
br i1 %60, label %104, label %61
61: ; preds = %29
%62 = load i32, i32* %30
br label %69
63: ; preds = %13
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.13, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %0
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.13, i64 0, i64 0))
%68 = tail call i32 @exit(i32 1)
unreachable
69: ; preds = %61, %98
%70 = phi i32 [ %99, %98 ], [ %58, %61 ]
%71 = phi i32 [ %100, %98 ], [ %62, %61 ]
%72 = phi i32 [ %101, %98 ], [ 0, %61 ]
%73 = add i32 %71, 3
%74 = icmp ult i32 %73, 7
br i1 %74, label %98, label %75
75: ; preds = %69, %75
%76 = phi i32 [ %92, %75 ], [ 0, %69 ]
%77 = load i32, i32* %42
%78 = add i32 %77, %76
%79 = load i32, i32* %48
%80 = sdiv i32 %79, 8
%81 = mul i32 %80, %78
%82 = load i32, i32* %45
%83 = add i32 %82, %72
%84 = load i32, i32* %20
%85 = mul i32 %83, %84
%86 = add i32 %85, %81
%87 = zext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %57, i64 %87
store i8 -1, i8* %88
%89 = getelementptr inbounds i8, i8* %88, i64 1
store i8 -1, i8* %89
%90 = getelementptr inbounds i8, i8* %88, i64 2
store i8 -1, i8* %90
%91 = getelementptr inbounds i8, i8* %88, i64 3
store i8 0, i8* %91
%92 = add nuw i32 %76, 1
%93 = load i32, i32* %30
%94 = sdiv i32 %93, 4
%95 = icmp ult i32 %92, %94
br i1 %95, label %75, label %96
96: ; preds = %75
%97 = load i32, i32* %33
br label %98
98: ; preds = %96, %69
%99 = phi i32 [ %97, %96 ], [ %70, %69 ]
%100 = phi i32 [ %93, %96 ], [ %71, %69 ]
%101 = add nuw i32 %72, 1
%102 = sdiv i32 %99, 4
%103 = icmp ult i32 %101, %102
br i1 %103, label %69, label %104
104: ; preds = %98, %29
%105 = call i32 (...) @getchar()
%106 = load i32, i32* %17
%107 = call i32 @munmap(i8* %57, i32 %106)
%108 = call i32 @close(i32 %6)
ret i32 0
}