#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 */

/* Variables and functions */
int /*<<< orphan*/ get_binary_version(char *);
int /*<<< orphan*/ get_cache_version(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strncmp(char *, char *, int);
int is_new_version() {
  char buf_old[(10000)];
  char buf_new[(10000)];
  get_cache_version(buf_old);
  printf("Previous MAME version is: %s\n", buf_old);
  get_binary_version(buf_new);
  printf("Current MAME version is:  %s\n", buf_new);
  if (strncmp(buf_new, buf_old, sizeof buf_old)) {
    printf("New version available\n");
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<is_new_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e30,%rsp
lea    -0x2720(%rbp),%rdi
call   1060 <get_cache_version@plt>
lea    -0x2720(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x4e30(%rbp),%rdi
call   1040 <get_binary_version@plt>
lea    -0x4e30(%rbp),%rsi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x4e30(%rbp),%rdi
lea    -0x2720(%rbp),%rsi
mov    $0x2710,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11c9 <is_new_version+0x89>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d0 <is_new_version+0x90>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4e30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_new_version>:
push   %rbp
push   %r14
push   %rbx
sub    $0x4e20,%rsp
lea    0x2710(%rsp),%r14
mov    %r14,%rdi
call   1070 <get_cache_version@plt>
lea    0xe8e(%rip),%rdi
xor    %ebp,%ebp
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <get_binary_version@plt>
lea    0xe8e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2710,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11c0 <is_new_version+0x70>
lea    0xe86(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x4e20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Previous MAME version is: %s\0A\00"
@.str.1 = [30 x i8] c"Current MAME version is: %s\0A\00"
@.str.2 = [23 x i8] c"New version available\0A\00"
define i32 @is_new_version() {
%1 = alloca i32
%2 = alloca [10000 x i8]
%3 = alloca [10000 x i8]
%4 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%5 = call i32 @get_cache_version(i8* %4)
%6 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%9 = call i32 @get_binary_version(i8* %8)
%10 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%14 = call i64 @strncmp(i8* %12, i8* %13, i32 10000)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %19
18: ; preds = %0
store i32 0, i32* %1
br label %19
19: ; preds = %18, %16
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [30 x i8] c"Previous MAME version is: %s\0A\00"
@.str.1 = [30 x i8] c"Current MAME version is: %s\0A\00"
@str = [22 x i8] c"New version available\00"
define i32 @is_new_version() {
%1 = alloca [10000 x i8]
%2 = alloca [10000 x i8]
%3 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%5 = call i32 @get_cache_version(i8* %3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %3)
%7 = call i32 @get_binary_version(i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%9 = call i64 @strncmp(i8* %4, i8* %3, i32 10000)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %0, %11
%14 = phi i32 [ 1, %11 ], [ 0, %0 ]
ret i32 %14
}