#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 stat {
  int dummy;
};

/* Variables and functions */
int O_NONBLOCK;
int O_RDONLY;
int /*<<< orphan*/ free(void *);
void *malloc(int /*<<< orphan*/);
int /*<<< orphan*/ open(char *, int);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ static_var(int);
int main(int argc, char *argv[]) {
  unsigned int ce_size;
  char *pdev_name = NULL;
  struct stat buf;
  void *ptr = malloc(0);
  ce_size = (((0) + ((2048) - 1)) & ~((2048) - 1));
  printf("%d\n", ce_size);
  static_var(1);
  static_var(10);
  while (ptr)
    free(ptr);
  open(pdev_name, O_RDONLY | O_NONBLOCK);
  stat(pdev_name, &buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
xor    %edi,%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <static_var@plt>
mov    $0xa,%edi
call   1060 <static_var@plt>
cmpq   $0x0,-0x30(%rbp)
je     11cc <main+0x6c>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
jmp    11b3 <main+0x53>
mov    -0x20(%rbp),%rdi
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
mov    0x2e08(%rip),%rax
or     (%rax),%esi
call   1080 <open@plt>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <stat@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xe8a(%rip),%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <static_var@plt>
mov    $0xa,%edi
call   1060 <static_var@plt>
test   %rbx,%rbx
je     11aa <main+0x4a>
mov    %rbx,%rdi
call   1030 <free@plt>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    11a0 <main+0x40>
mov    0x2e2f(%rip),%rax
mov    0x2e30(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
xor    %edi,%edi
call   1080 <open@plt>
lea    0x8(%rsp),%rsi
xor    %edi,%edi
call   1050 <stat@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [4 x i8] c"%d\0A\00"
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
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.stat
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
%10 = call i8* @malloc(i32 0)
store i8* %10, i8** %9
store i32 0, i32* %6
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @static_var(i32 1)
%14 = call i32 @static_var(i32 10)
br label %15
15: ; preds = %18, %2
%16 = load i8*, i8** %9
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i8*, i8** %9
%20 = call i32 @free(i8* %19)
br label %15
21: ; preds = %15
%22 = load i8*, i8** %7
%23 = load i32, i32* @O_RDONLY
%24 = load i32, i32* @O_NONBLOCK
%25 = or i32 %23, %24
%26 = call i32 @open(i8* %22, i32 %25)
%27 = load i8*, i8** %7
%28 = call i32 @stat(i8* %27, %struct.stat* %8)
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [4 x i8] c"%d\0A\00"
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = tail call i8* @malloc(i32 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%7 = tail call i32 @static_var(i32 1)
%8 = tail call i32 @static_var(i32 10)
%9 = icmp eq i8* %5, null
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = tail call i32 @free(i8* %5)
br label %12
12: ; preds = %12, %10
%13 = tail call i32 @free(i8* %5)
br label %12
14: ; preds = %2
%15 = load i32, i32* @O_RDONLY
%16 = load i32, i32* @O_NONBLOCK
%17 = or i32 %16, %15
%18 = tail call i32 @open(i8* null, i32 %17)
%19 = call i32 @stat(i8* null, %struct.stat* %3)
ret i32 0
}