#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int write(int, char *, int);
int create_bitmap(int fd, char *bitmap) {
  int cur_pos, len, temp;
  cur_pos = lseek(fd, 0, SEEK_CUR);
  temp = 1024 + 2 * 4096;
  printf("cur_pos == %d and temp == %d", cur_pos, temp);
  if (cur_pos != (1024 + 2 * 4096)) {
    printf("Error in creating bitmap\n");
    return -1;
  }
  len = write(fd, bitmap, 4096);
  if (len != 4096) {
    printf("Error in creating bitmap \n");
    return -1;
  }
  return len;
}


x86 assembly (clang, -O0):
<create_bitmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e9f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,-0x14(%rbp)
movl   $0x2400,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x2400,-0x14(%rbp)
je     1197 <create_bitmap+0x67>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d8 <create_bitmap+0xa8>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1000,%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1000,-0x18(%rbp)
je     11d2 <create_bitmap+0xa2>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d8 <create_bitmap+0xa8>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_bitmap>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    %eax,%ebx
lea    0xe9e(%rip),%rdi
mov    %eax,%esi
mov    $0x2400,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x2400,%ebx
jne    119c <create_bitmap+0x5c>
mov    $0x1000,%ebx
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x1000,%edx
call   1040 <write@plt>
cmp    $0x1000,%eax
je     11ad <create_bitmap+0x6d>
lea    0xe83(%rip),%rdi
jmp    11a3 <create_bitmap+0x63>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
@.str = [29 x i8] c"cur_pos == %d and temp == %d\00"
@.str.1 = [26 x i8] c"Error in creating bitmap\0A\00"
@.str.2 = [27 x i8] c"Error in creating bitmap \0A\00"
define i32 @create_bitmap(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%9 = load i32, i32* %4
%10 = load i32, i32* @SEEK_CUR
%11 = call i32 @lseek(i32 %9, i32 0, i32 %10)
store i32 %11, i32* %6
store i32 9216, i32* %8
%12 = load i32, i32* %6
%13 = load i32, i32* %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13)
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 9216
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %29
19: ; preds = %2
%20 = load i32, i32* %4
%21 = load i8*, i8** %5
%22 = call i32 @write(i32 %20, i8* %21, i32 4096)
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = icmp ne i32 %23, 4096
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %29
27: ; preds = %19
%28 = load i32, i32* %7
store i32 %28, i32* %3
br label %29
29: ; preds = %27, %25, %17
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
@.str = [29 x i8] c"cur_pos == %d and temp == %d\00"
@str = [26 x i8] c"Error in creating bitmap \00"
@str.3 = [25 x i8] c"Error in creating bitmap\00"
define i32 @create_bitmap(i32 %0, i8* nocapture %1) {
%3 = load i32, i32* @SEEK_CUR
%4 = tail call i32 @lseek(i32 %0, i32 0, i32 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %4, i32 9216)
%6 = icmp eq i32 %4, 9216
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @write(i32 %0, i8* %1, i32 4096)
%9 = icmp eq i32 %8, 4096
br i1 %9, label %13, label %10
10: ; preds = %7, %2
%11 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0), %2 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0), %7 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
br label %13
13: ; preds = %10, %7
%14 = phi i32 [ 4096, %7 ], [ -1, %10 ]
ret i32 %14
}