#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*/ die(char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
char *tracecmd_get_tracing_file(char *);
int /*<<< orphan*/ tracecmd_put_tracing_file(char *);
void reset_max_latency(void) {
  FILE *fp;
  char *path;
  path = tracecmd_get_tracing_file("tracing_max_latency");
  fp = fopen(path, "w");
  if (!fp)
    die("writing to '%s'", path);
  tracecmd_put_tracing_file(path);
  fwrite("0", 1, 1, fp);
  fclose(fp);
}


x86 assembly (clang, -O0):
<reset_max_latency>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1050 <tracecmd_get_tracing_file@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11a7 <reset_max_latency+0x47>
mov    -0x10(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1070 <die@plt>
mov    -0x10(%rbp),%rdi
call   1030 <tracecmd_put_tracing_file@plt>
mov    -0x8(%rbp),%rcx
lea    0xe6b(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1080 <fwrite@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_max_latency>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%rdi
call   1060 <tracecmd_get_tracing_file@plt>
mov    %rax,%r14
lea    0xe9a(%rip),%rsi
mov    %rax,%rdi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1199 <reset_max_latency+0x39>
lea    0xe85(%rip),%rdi
mov    %r14,%rsi
call   1080 <die@plt>
mov    %r14,%rdi
call   1030 <tracecmd_put_tracing_file@plt>
mov    $0x30,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fclose@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"tracing_max_latency\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [16 x i8] c"writing to '%s'\00"
@.str.3 = [2 x i8] c"0\00"
define void @reset_max_latency() {
%1 = alloca i32*
%2 = alloca i8*
%3 = call i8* @tracecmd_get_tracing_file(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %1
%6 = load i32*, i32** %1
%7 = icmp ne i32* %6, null
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = load i8*, i8** %2
%10 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %0
%12 = load i8*, i8** %2
%13 = call i32 @tracecmd_put_tracing_file(i8* %12)
%14 = load i32*, i32** %1
%15 = call i32 @fwrite(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 1, i32* %14)
%16 = load i32*, i32** %1
%17 = call i32 @fclose(i32* %16)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"tracing_max_latency\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [16 x i8] c"writing to '%s'\00"
define void @reset_max_latency() {
%1 = tail call i8* @tracecmd_get_tracing_file(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %6
6: ; preds = %4, %0
%7 = tail call i32 @tracecmd_put_tracing_file(i8* %1)
%8 = tail call i32 @fputc(i32 48, i32* %2)
%9 = tail call i32 @fclose(i32* %2)
ret void
}