#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 {
  char *st_blksize;
  char *st_blocks;
  int /*<<< orphan*/ st_mtime;
  int /*<<< orphan*/ st_atime;
  int /*<<< orphan*/ st_ctime;
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ S_ISLNK(int /*<<< orphan*/);
scalar_t__ S_ISREG(int /*<<< orphan*/);
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
void print_info(struct stat *buf) {
  if (S_ISLNK(buf->st_mode)) {
    printf("It is a symbolic link\n");
  }
  if (S_ISREG(buf->st_mode)) {
    printf("It is a normal file\n");
  }
  if (S_ISDIR(buf->st_mode)) {
    printf("It is a directory\n");
  }
  printf("block size is %ld\n", buf->st_blksize);
  printf("number of blocks is %ld\n", buf->st_blocks);
  printf("created time is: %s", ctime(&buf->st_ctime));
  printf("last visiting is: %s", ctime(&buf->st_atime));
  printf("last modifying is: %s", ctime(&buf->st_mtime));
  putchar('\n');
}


x86 assembly (clang, -O0):
<print_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%edi
call   1040 <S_ISLNK@plt>
cmp    $0x0,%rax
je     1190 <print_info+0x30>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%edi
call   1080 <S_ISREG@plt>
cmp    $0x0,%rax
je     11b4 <print_info+0x54>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%edi
call   1070 <S_ISDIR@plt>
cmp    $0x0,%rax
je     11d8 <print_info+0x78>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
add    $0x18,%rdi
call   1050 <ctime@plt>
mov    %rax,%rsi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
add    $0x14,%rdi
call   1050 <ctime@plt>
mov    %rax,%rsi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1050 <ctime@plt>
mov    %rax,%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_info>:
push   %rbx
mov    %rdi,%rbx
mov    0x1c(%rdi),%edi
call   1040 <S_ISLNK@plt>
test   %rax,%rax
je     118d <print_info+0x1d>
lea    0xf09(%rip),%rdi
call   1050 <puts@plt>
mov    0x1c(%rbx),%edi
call   1090 <S_ISREG@plt>
test   %rax,%rax
je     11a6 <print_info+0x36>
lea    0xedc(%rip),%rdi
call   1050 <puts@plt>
mov    0x1c(%rbx),%edi
call   1080 <S_ISDIR@plt>
test   %rax,%rax
je     11bf <print_info+0x4f>
lea    0xeb1(%rip),%rdi
call   1050 <puts@plt>
mov    (%rbx),%rsi
lea    0xe37(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%rbx),%rsi
lea    0xe38(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x18(%rbx),%rdi
call   1060 <ctime@plt>
lea    0xe3a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x14(%rbx),%rdi
call   1060 <ctime@plt>
lea    0xe34(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x10,%rbx
mov    %rbx,%rdi
call   1060 <ctime@plt>
lea    0xe2c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.stat = type { i8*, i8*, i32, i32, i32, i32 }
@.str = [23 x i8] c"It is a symbolic link\0A\00"
@.str.1 = [21 x i8] c"It is a normal file\0A\00"
@.str.2 = [19 x i8] c"It is a directory\0A\00"
@.str.3 = [19 x i8] c"block size is %ld\0A\00"
@.str.4 = [25 x i8] c"number of blocks is %ld\0A\00"
@.str.5 = [20 x i8] c"created time is: %s\00"
@.str.6 = [21 x i8] c"last visiting is: %s\00"
@.str.7 = [22 x i8] c"last modifying is: %s\00"
define void @print_info(%struct.stat* %0) {
%2 = alloca %struct.stat*
store %struct.stat* %0, %struct.stat** %2
%3 = load %struct.stat*, %struct.stat** %2
%4 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 5
%5 = load i32, i32* %4
%6 = call i64 @S_ISLNK(i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load %struct.stat*, %struct.stat** %2
%12 = getelementptr inbounds %struct.stat, %struct.stat* %11, i32 0, i32 5
%13 = load i32, i32* %12
%14 = call i64 @S_ISREG(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %10
%19 = load %struct.stat*, %struct.stat** %2
%20 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 5
%21 = load i32, i32* %20
%22 = call i64 @S_ISDIR(i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24, %18
%27 = load %struct.stat*, %struct.stat** %2
%28 = getelementptr inbounds %struct.stat, %struct.stat* %27, i32 0, i32 0
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %29)
%31 = load %struct.stat*, %struct.stat** %2
%32 = getelementptr inbounds %struct.stat, %struct.stat* %31, i32 0, i32 1
%33 = load i8*, i8** %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %33)
%35 = load %struct.stat*, %struct.stat** %2
%36 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 4
%37 = call i8* @ctime(i32* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %37)
%39 = load %struct.stat*, %struct.stat** %2
%40 = getelementptr inbounds %struct.stat, %struct.stat* %39, i32 0, i32 3
%41 = call i8* @ctime(i32* %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %41)
%43 = load %struct.stat*, %struct.stat** %2
%44 = getelementptr inbounds %struct.stat, %struct.stat* %43, i32 0, i32 2
%45 = call i8* @ctime(i32* %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %45)
%47 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
%struct.stat = type { i8*, i8*, i32, i32, i32, i32 }
@.str.3 = [19 x i8] c"block size is %ld\0A\00"
@.str.4 = [25 x i8] c"number of blocks is %ld\0A\00"
@.str.5 = [20 x i8] c"created time is: %s\00"
@.str.6 = [21 x i8] c"last visiting is: %s\00"
@.str.7 = [22 x i8] c"last modifying is: %s\00"
@str = [18 x i8] c"It is a directory\00"
@str.8 = [20 x i8] c"It is a normal file\00"
@str.9 = [22 x i8] c"It is a symbolic link\00"
define void @print_info(%struct.stat* %0) {
%2 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 5
%3 = load i32, i32* %2
%4 = tail call i64 @S_ISLNK(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.9, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = tail call i64 @S_ISREG(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.8, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = load i32, i32* %2
%16 = tail call i64 @S_ISDIR(i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
%21 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%22 = load i8*, i8** %21
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 1
%25 = load i8*, i8** %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 4
%28 = tail call i8* @ctime(i32* %27)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 3
%31 = tail call i8* @ctime(i32* %30)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 2
%34 = tail call i8* @ctime(i32* %33)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %34)
%36 = tail call i32 @putchar(i8 signext 10)
ret void
}