#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 st_uid;
  int st_gid;
  int st_ino;
  int st_size;
  int st_dev;
  int st_blocks;
  int st_blksize;
  int st_mode;
  int st_nlink;
  int st_atime;
  int st_mtime;
  int st_ctime;
};

/* Variables and functions */
int /*<<< orphan*/ basename(char *);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int log_stat(const char *pathname, struct stat *st) {
  if (strcmp(basename((char *)pathname), "ncsvc.log"))
    return -5555;
  do {
  } while (0);
  st->st_uid = st->st_gid = 0x3e8;
  st->st_ino = 0xee6f8b;
  st->st_size = 0x995ead;
  st->st_dev = 0x806;
  st->st_blocks = 0x4cb8;
  st->st_blksize = 0x1000;
  st->st_mode = 0x81a4;
  st->st_nlink = 1;
  st->st_atime = 0x528162a1;
  st->st_mtime = 0x52a3e2b6;
  st->st_ctime = 0x52a3e2b6;
  return 0;
}


x86 assembly (clang, -O0):
<log_stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <basename@plt>
mov    %eax,%edi
lea    0xebe(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     115d <log_stat+0x3d>
movl   $0xffffea4d,-0x4(%rbp)
jmp    11f1 <log_stat+0xd1>
jmp    1162 <log_stat+0x42>
jmp    1167 <log_stat+0x47>
mov    -0x18(%rbp),%rax
movl   $0x3e8,0x4(%rax)
mov    -0x18(%rbp),%rax
movl   $0x3e8,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xee6f8b,0x8(%rax)
mov    -0x18(%rbp),%rax
movl   $0x995ead,0xc(%rax)
mov    -0x18(%rbp),%rax
movl   $0x806,0x10(%rax)
mov    -0x18(%rbp),%rax
movl   $0x4cb8,0x14(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1000,0x18(%rax)
mov    -0x18(%rbp),%rax
movl   $0x81a4,0x1c(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,0x20(%rax)
mov    -0x18(%rbp),%rax
movl   $0x528162a1,0x24(%rax)
mov    -0x18(%rbp),%rax
movl   $0x52a3e2b6,0x28(%rax)
mov    -0x18(%rbp),%rax
movl   $0x52a3e2b6,0x2c(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_stat>:
push   %rbx
mov    %rsi,%rbx
call   1040 <basename@plt>
lea    0xf00(%rip),%rsi
mov    %eax,%edi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    $0xffffea4d,%eax
test   %rcx,%rcx
je     1146 <log_stat+0x26>
pop    %rbx
ret
movaps 0xeb3(%rip),%xmm0
movups %xmm0,(%rbx)
movaps 0xeb9(%rip),%xmm0
movups %xmm0,0x10(%rbx)
movaps 0xebe(%rip),%xmm0
movups %xmm0,0x20(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [10 x i8] c"ncsvc.log\00"
define i32 @log_stat(i8* %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.stat*
store i8* %0, i8** %4
store %struct.stat* %1, %struct.stat** %5
%6 = load i8*, i8** %4
%7 = call i32 @basename(i8* %6)
%8 = call i64 @strcmp(i32 %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -5555, i32* %3
br label %38
11: ; preds = %2
br label %12
12: ; preds = %11
br label %13
13: ; preds = %12
%14 = load %struct.stat*, %struct.stat** %5
%15 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 1
store i32 1000, i32* %15
%16 = load %struct.stat*, %struct.stat** %5
%17 = getelementptr inbounds %struct.stat, %struct.stat* %16, i32 0, i32 0
store i32 1000, i32* %17
%18 = load %struct.stat*, %struct.stat** %5
%19 = getelementptr inbounds %struct.stat, %struct.stat* %18, i32 0, i32 2
store i32 15626123, i32* %19
%20 = load %struct.stat*, %struct.stat** %5
%21 = getelementptr inbounds %struct.stat, %struct.stat* %20, i32 0, i32 3
store i32 10051245, i32* %21
%22 = load %struct.stat*, %struct.stat** %5
%23 = getelementptr inbounds %struct.stat, %struct.stat* %22, i32 0, i32 4
store i32 2054, i32* %23
%24 = load %struct.stat*, %struct.stat** %5
%25 = getelementptr inbounds %struct.stat, %struct.stat* %24, i32 0, i32 5
store i32 19640, i32* %25
%26 = load %struct.stat*, %struct.stat** %5
%27 = getelementptr inbounds %struct.stat, %struct.stat* %26, i32 0, i32 6
store i32 4096, i32* %27
%28 = load %struct.stat*, %struct.stat** %5
%29 = getelementptr inbounds %struct.stat, %struct.stat* %28, i32 0, i32 7
store i32 33188, i32* %29
%30 = load %struct.stat*, %struct.stat** %5
%31 = getelementptr inbounds %struct.stat, %struct.stat* %30, i32 0, i32 8
store i32 1, i32* %31
%32 = load %struct.stat*, %struct.stat** %5
%33 = getelementptr inbounds %struct.stat, %struct.stat* %32, i32 0, i32 9
store i32 1384211105, i32* %33
%34 = load %struct.stat*, %struct.stat** %5
%35 = getelementptr inbounds %struct.stat, %struct.stat* %34, i32 0, i32 10
store i32 1386472118, i32* %35
%36 = load %struct.stat*, %struct.stat** %5
%37 = getelementptr inbounds %struct.stat, %struct.stat* %36, i32 0, i32 11
store i32 1386472118, i32* %37
store i32 0, i32* %3
br label %38
38: ; preds = %13, %10
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [10 x i8] c"ncsvc.log\00"
define i32 @log_stat(i8* %0, %struct.stat* nocapture writeonly %1) {
%3 = tail call i32 @basename(i8* %0)
%4 = tail call i64 @strcmp(i32 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = bitcast %struct.stat* %1 to <4 x i32>*
store <4 x i32> <i32 1000, i32 1000, i32 15626123, i32 10051245>, <4 x i32>* %7
%8 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 4
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 2054, i32 19640, i32 4096, i32 33188>, <4 x i32>* %9
%10 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 8
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 1, i32 1384211105, i32 1386472118, i32 1386472118>, <4 x i32>* %11
br label %12
12: ; preds = %2, %6
%13 = phi i32 [ 0, %6 ], [ -5555, %2 ]
ret i32 %13
}