#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;
};
typedef int mode_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ mknod(char *, int, int);
int /*<<< orphan*/ printf(char *, char *);
int stat(char *, struct stat *);
int /*<<< orphan*/ unlink(char *);
int main() {
  struct stat statbuf;
  int ret = 0;
  char *loop255 = "/dev/loop255";
  char *loop256 = "/dev/loop256";
  mode_t mode = 0660;
  mknod(loop255, mode, 0x7ff);
  mknod(loop256, mode, 0x100700);
  ret = stat(loop255, &statbuf);
  if (ret < 0) {
    printf("stat: Cant stat %s\n", loop255);
    unlink(loop255);
    exit(1);
  }
  ret = stat(loop256, &statbuf);
  if (ret < 0) {
    printf("stat: Cant stat %s\n", loop256);
    unlink(loop255);
    unlink(loop256);
    exit(1);
  }
  unlink(loop255);
  unlink(loop256);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe93(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe95(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x1b0,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x7ff,%edx
call   1060 <mknod@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x100700,%edx
call   1060 <mknod@plt>
mov    -0x18(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <stat@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    11e2 <main+0x92>
mov    -0x18(%rbp),%rsi
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <unlink@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x20(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <stat@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1228 <main+0xd8>
mov    -0x20(%rbp),%rsi
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x20(%rbp),%rdi
call   1030 <unlink@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x20(%rbp),%rdi
call   1030 <unlink@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xea4(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1b0,%esi
mov    $0x7ff,%edx
call   1060 <mknod@plt>
lea    0xe98(%rip),%rdi
mov    $0x1b0,%esi
mov    $0x100700,%edx
call   1060 <mknod@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <stat@plt>
test   %eax,%eax
jns    11ad <main+0x5d>
lea    0xe7e(%rip),%rdi
lea    0xe5d(%rip),%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
jmp    11e4 <main+0x94>
lea    0xe59(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <stat@plt>
test   %eax,%eax
jns    11f6 <main+0xa6>
lea    0xe51(%rip),%rdi
lea    0xe3d(%rip),%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xe21(%rip),%rdi
call   1030 <unlink@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe03(%rip),%rdi
call   1030 <unlink@plt>
lea    0xe04(%rip),%rdi
call   1030 <unlink@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [13 x i8] c"/dev/loop255\00"
@.str.1 = [13 x i8] c"/dev/loop256\00"
@.str.2 = [20 x i8] c"stat: Cant stat %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.stat
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %5
store i32 432, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %6
%9 = call i32 @mknod(i8* %7, i32 %8, i32 2047)
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @mknod(i8* %10, i32 %11, i32 1050368)
%13 = load i8*, i8** %4
%14 = call i32 @stat(i8* %13, %struct.stat* %2)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %0
%18 = load i8*, i8** %4
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %4
%21 = call i32 @unlink(i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %0
%24 = load i8*, i8** %5
%25 = call i32 @stat(i8* %24, %struct.stat* %2)
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %36
28: ; preds = %23
%29 = load i8*, i8** %5
%30 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = load i8*, i8** %4
%32 = call i32 @unlink(i8* %31)
%33 = load i8*, i8** %5
%34 = call i32 @unlink(i8* %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %23
%37 = load i8*, i8** %4
%38 = call i32 @unlink(i8* %37)
%39 = load i8*, i8** %5
%40 = call i32 @unlink(i8* %39)
%41 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [13 x i8] c"/dev/loop255\00"
@.str.1 = [13 x i8] c"/dev/loop256\00"
@.str.2 = [20 x i8] c"stat: Cant stat %s\0A\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = tail call i32 @mknod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 432, i32 2047)
%4 = tail call i32 @mknod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 432, i32 1050368)
%5 = call i32 @stat(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %0
%12 = call i32 @stat(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %struct.stat* %1)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %11
%20 = tail call i32 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%21 = tail call i32 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%22 = tail call i32 @exit(i32 0)
unreachable
}