#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ *strstr(char *, char *);
void get_install_date(char *arg1) {
  char *cmd = "systeminfo | find /i \"original\"";
  FILE *fp;
  char installdate[200];
  char buf[128];
  if ((fp = popen(cmd, "r")) == NULL) {
    0;
    exit(0);
  }
  while (fgets(buf, 128, fp) != NULL) {
    strcat(installdate, buf);
  }
  0;
  0;
  pclose(fp);
  if (strstr(installdate, arg1) != NULL) {
    0;
  } else {
    0;
    exit(0);
  }
}


x86 assembly (clang, -O0):
<get_install_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe8a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    119f <get_install_date+0x3f>
xor    %edi,%edi
call   1070 <exit@plt>
jmp    11a4 <get_install_date+0x44>
lea    -0x160(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x80,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11db <get_install_date+0x7b>
lea    -0xe0(%rbp),%rdi
lea    -0x160(%rbp),%rsi
call   1060 <strcat@plt>
jmp    11a4 <get_install_date+0x44>
mov    -0x18(%rbp),%rdi
call   1030 <pclose@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
je     1203 <get_install_date+0xa3>
jmp    120a <get_install_date+0xaa>
xor    %edi,%edi
call   1070 <exit@plt>
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_install_date>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rdi,%r14
lea    0xe88(%rip),%rdi
lea    0xea1(%rip),%rsi
call   1050 <popen@plt>
test   %rax,%rax
je     11fc <get_install_date+0x9c>
mov    %rax,%r12
mov    %rsp,%rdi
mov    $0x80,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11d0 <get_install_date+0x70>
lea    0x80(%rsp),%r15
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    11b0 <get_install_date+0x50>
mov    %r12,%rdi
call   1030 <pclose@plt>
lea    0x80(%rsp),%rdi
mov    %r14,%rsi
call   1080 <strstr@plt>
test   %rax,%rax
je     11fc <get_install_date+0x9c>
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"systeminfo | find /i \22original\22\00"
@.str.1 = [2 x i8] c"r\00"
define void @get_install_date(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [200 x i8]
%6 = alloca [128 x i8]
store i8* %0, i8** %2
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8** %3
%7 = load i8*, i8** %3
%8 = call i32* @popen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %4
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %1
br label %13
13: ; preds = %18, %12
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%15 = load i32*, i32** %4
%16 = call i32* @fgets(i8* %14, i32 128, i32* %15)
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%21 = call i32 @strcat(i8* %19, i8* %20)
br label %13
22: ; preds = %13
%23 = load i32*, i32** %4
%24 = call i32 @pclose(i32* %23)
%25 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%26 = load i8*, i8** %2
%27 = call i32* @strstr(i8* %25, i8* %26)
%28 = icmp ne i32* %27, null
br i1 %28, label %29, label %30
29: ; preds = %22
br label %32
30: ; preds = %22
%31 = call i32 @exit(i32 0)
unreachable
32: ; preds = %29
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"systeminfo | find /i \22original\22\00"
@.str.1 = [2 x i8] c"r\00"
define void @get_install_date(i8* nocapture %0) {
%2 = alloca [200 x i8]
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = tail call i32* @popen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = call i32* @fgets(i8* %5, i32 128, i32* %6)
%10 = icmp eq i32* %9, null
br i1 %10, label %17, label %13
11: ; preds = %1
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %8, %13
%14 = call i32 @strcat(i8* %4, i8* %5)
%15 = call i32* @fgets(i8* %5, i32 128, i32* %6)
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %13
17: ; preds = %13, %8
%18 = call i32 @pclose(i32* %6)
%19 = call i32* @strstr(i8* %4, i8* dereferenceable(1) %0)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %17
ret void
}