#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*/ fprintf(int /*<<< orphan*/ *, char *, int, ...);
int /*<<< orphan*/ symbol(int);
void print_vcd_point(FILE *f, int ind, int x, double val) {
  static int last_time = -1;
  if (x != last_time) {
    fprintf(f, "#%d\n", x);
    last_time = x;
  }
  fprintf(f, "%d%c\n", (int)val, symbol(ind));
}


x86 assembly (clang, -O0):
<print_vcd_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    0x2ef0(%rip),%eax
je     1164 <print_vcd_point+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,0x2ecc(%rip)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <symbol@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_vcd_point>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
cmp    %edx,0x2efc(%rip)
je     115b <print_vcd_point+0x3b>
mov    %edx,%ebp
lea    0xec1(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
movsd  %xmm0,0x8(%rsp)
call   1030 <fprintf@plt>
movsd  0x8(%rsp),%xmm0
mov    %ebp,0x2ed5(%rip)
cvttsd2si %xmm0,%ebp
mov    %r14d,%edi
call   1040 <symbol@plt>
lea    0xe97(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@print_vcd_point.last_time = internal global i32 -1
@.str = [5 x i8] c"#%d\0A\00"
@.str.1 = [6 x i8] c"%d%c\0A\00"
define void @print_vcd_point(i32* %0, i32 %1, i32 %2, double %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store double %3, double* %8
%9 = load i32, i32* %7
%10 = load i32, i32* @print_vcd_point.last_time
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = load i32*, i32** %5
%14 = load i32, i32* %7
%15 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %7
store i32 %16, i32* @print_vcd_point.last_time
br label %17
17: ; preds = %12, %4
%18 = load i32*, i32** %5
%19 = load double, double* %8
%20 = fptosi double %19 to i32
%21 = load i32, i32* %6
%22 = call i32 @symbol(i32 %21)
%23 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %22)
ret void
}

LLVM IR (-O2):
@print_vcd_point.last_time = internal unnamed_addr global i32 -1
@.str = [5 x i8] c"#%d\0A\00"
@.str.1 = [6 x i8] c"%d%c\0A\00"
define void @print_vcd_point(i32* nocapture %0, i32 %1, i32 %2, double %3) {
%5 = load i32, i32* @print_vcd_point.last_time
%6 = icmp eq i32 %5, %2
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
store i32 %2, i32* @print_vcd_point.last_time
br label %9
9: ; preds = %7, %4
%10 = fptosi double %3 to i32
%11 = tail call i32 @symbol(i32 %1)
%12 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %11)
ret void
}