#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 /*<<< orphan*/ st_rdev;
  int /*<<< orphan*/ st_mode;
  int /*<<< orphan*/ st_dev;
};

/* Variables and functions */
scalar_t__ S_ISBLK(int /*<<< orphan*/);
scalar_t__ S_ISCHR(int /*<<< orphan*/);
scalar_t__ lstat(char *, struct stat *);
int major(int /*<<< orphan*/);
int minor(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int i;
  struct stat stBuff;
  for (i = 1; i < argc; ++i) {
    if (lstat(argv[i], &stBuff)) {
      perror("Error::");
      continue;
    }
    printf("Major Device Number ::%d\n", major(stBuff.st_dev));
    printf("Minor Device Number ::%d\n", minor(stBuff.st_dev));
    if ((S_ISBLK(stBuff.st_mode) || S_ISCHR(stBuff.st_mode))) {
      printf("Raw Major Device Number ::%d\n", major(stBuff.st_rdev));
      printf("Raw Minor Device Number ::%d\n", minor(stBuff.st_rdev));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1258 <main+0xe8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <lstat@plt>
cmp    $0x0,%rax
je     11c9 <main+0x59>
lea    0xe41(%rip),%rdi
call   1090 <perror@plt>
jmp    124a <main+0xda>
mov    -0x18(%rbp),%edi
call   1050 <major@plt>
mov    %eax,%esi
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
call   1030 <minor@plt>
mov    %eax,%esi
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
call   1080 <S_ISBLK@plt>
cmp    $0x0,%rax
jne    1219 <main+0xa9>
mov    -0x1c(%rbp),%edi
call   1070 <S_ISCHR@plt>
cmp    $0x0,%rax
je     1245 <main+0xd5>
mov    -0x20(%rbp),%edi
call   1050 <major@plt>
mov    %eax,%esi
lea    0xdde(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
call   1030 <minor@plt>
mov    %eax,%esi
lea    0xde6(%rip),%rdi
call   1040 <printf@plt>
jmp    124a <main+0xda>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jl     124d <main+0xdd>
mov    %rsi,%rbx
mov    %edi,%r15d
mov    $0x1,%r12d
lea    0x8(%rsp),%r14
jmp    11d7 <main+0x67>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%ebp
mov    %ebp,%edi
call   1050 <major@plt>
lea    0xe56(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
call   1030 <minor@plt>
lea    0xe5f(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r15
je     124d <main+0xdd>
mov    (%rbx,%r12,8),%rdi
mov    %r14,%rsi
call   1060 <lstat@plt>
test   %rax,%rax
jne    123f <main+0xcf>
mov    0x10(%rsp),%ebp
mov    %ebp,%edi
call   1050 <major@plt>
lea    0xe12(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
call   1030 <minor@plt>
lea    0xe1b(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0xc(%rsp),%r13d
mov    %r13d,%edi
call   1080 <S_ISBLK@plt>
test   %rax,%rax
jne    11a0 <main+0x30>
mov    %r13d,%edi
call   1070 <S_ISCHR@plt>
test   %rax,%rax
jne    11a0 <main+0x30>
jmp    11ce <main+0x5e>
lea    0xdba(%rip),%rdi
call   1090 <perror@plt>
jmp    11ce <main+0x5e>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32 }
@.str = [8 x i8] c"Error::\00"
@.str.1 = [26 x i8] c"Major Device Number ::%d\0A\00"
@.str.2 = [26 x i8] c"Minor Device Number ::%d\0A\00"
@.str.3 = [30 x i8] c"Raw Major Device Number ::%d\0A\00"
@.str.4 = [30 x i8] c"Raw Minor Device Number ::%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.stat
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %8
8: ; preds = %50, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %53
12: ; preds = %8
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i64 @lstat(i8* %17, %struct.stat* %7)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %12
%21 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %50
22: ; preds = %12
%23 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 2
%24 = load i32, i32* %23
%25 = call i32 @major(i32 %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 2
%28 = load i32, i32* %27
%29 = call i32 @minor(i32 %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 1
%32 = load i32, i32* %31
%33 = call i64 @S_ISBLK(i32 %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %40, label %35
35: ; preds = %22
%36 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 1
%37 = load i32, i32* %36
%38 = call i64 @S_ISCHR(i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %49
40: ; preds = %35, %22
%41 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%42 = load i32, i32* %41
%43 = call i32 @major(i32 %42)
%44 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%46 = load i32, i32* %45
%47 = call i32 @minor(i32 %46)
%48 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %40, %35
br label %50
50: ; preds = %49, %20
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 1
store i32 %52, i32* %6
br label %8
53: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32 }
@.str = [8 x i8] c"Error::\00"
@.str.1 = [26 x i8] c"Major Device Number ::%d\0A\00"
@.str.2 = [26 x i8] c"Minor Device Number ::%d\0A\00"
@.str.3 = [30 x i8] c"Raw Major Device Number ::%d\0A\00"
@.str.4 = [30 x i8] c"Raw Minor Device Number ::%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %40
6: ; preds = %2
%7 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 2
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %6, %37
%12 = phi i64 [ 1, %6 ], [ %38, %37 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = call i64 @lstat(i8* %14, %struct.stat* %3)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %11
%18 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %37
19: ; preds = %11
%20 = load i32, i32* %7
%21 = tail call i32 @major(i32 %20)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = tail call i32 @minor(i32 %20)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %8
%26 = tail call i64 @S_ISBLK(i32 %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %19
%29 = tail call i64 @S_ISCHR(i32 %25)
%30 = icmp eq i64 %29, 0
br i1 %30, label %37, label %31
31: ; preds = %28, %19
%32 = load i32, i32* %9
%33 = tail call i32 @major(i32 %32)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = tail call i32 @minor(i32 %32)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %28, %31, %17
%38 = add nuw nsw i64 %12, 1
%39 = icmp eq i64 %38, %10
br i1 %39, label %40, label %11
40: ; preds = %37, %2
ret i32 0
}