#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*/ assert(int);
int compare_version(char *, char *);
int /*<<< orphan*/ printf(char *);
int main() {
  assert(compare_version("01", "1") == 0);
  printf("test1 ok\n");
  assert(compare_version("123", "123") == 0);
  printf("test2 ok\n");
  assert(compare_version("0.1", "0.0.1") == 1);
  printf("test3 ok\n");
  assert(compare_version("1.0", "1") == 0);
  printf("test4 ok\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1050 <compare_version@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xe98(%rip),%rsi
mov    %rsi,%rdi
call   1050 <compare_version@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7d(%rip),%rdi
lea    0xe74(%rip),%rsi
call   1050 <compare_version@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
lea    0xe49(%rip),%rsi
call   1050 <compare_version@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xecc(%rip),%rbx
mov    %rbx,%rsi
call   1050 <compare_version@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
mov    %rdi,%rsi
call   1050 <compare_version@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7a(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1050 <compare_version@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe73(%rip),%rdi
call   1030 <puts@plt>
lea    0xe51(%rip),%rdi
mov    %rbx,%rsi
call   1050 <compare_version@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe54(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"01\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [10 x i8] c"test1 ok\0A\00"
@.str.3 = [4 x i8] c"123\00"
@.str.4 = [10 x i8] c"test2 ok\0A\00"
@.str.5 = [4 x i8] c"0.1\00"
@.str.6 = [6 x i8] c"0.0.1\00"
@.str.7 = [10 x i8] c"test3 ok\0A\00"
@.str.8 = [4 x i8] c"1.0\00"
@.str.9 = [10 x i8] c"test4 ok\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @compare_version(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @compare_version(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @compare_version(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%13 = icmp eq i32 %12, 1
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 @compare_version(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"01\00"
@.str.1 = [2 x i8] c"1\00"
@.str.3 = [4 x i8] c"123\00"
@.str.5 = [4 x i8] c"0.1\00"
@.str.6 = [6 x i8] c"0.0.1\00"
@.str.8 = [4 x i8] c"1.0\00"
@str = [9 x i8] c"test1 ok\00"
@str.10 = [9 x i8] c"test2 ok\00"
@str.11 = [9 x i8] c"test3 ok\00"
@str.12 = [9 x i8] c"test4 ok\00"
define i32 @main() {
%1 = tail call i32 @compare_version(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @compare_version(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0))
%11 = tail call i32 @compare_version(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%12 = icmp eq i32 %11, 1
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.11, i64 0, i64 0))
%16 = tail call i32 @compare_version(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.12, i64 0, i64 0))
ret i32 0
}