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

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ sprintf(char *, char *, char *, long, char *);
int system(char *);
pid_t run_driftlog(char *server, long runtime, char *logfile) {
  pid_t pid;
  int ret;
  char buf[256];
  sprintf(buf, "./drift-log.py %s 60 %ld | tee %s", server, runtime, logfile);
  pid = fork();
  if (!pid) {
    ret = system(buf);
    exit(0);
  }
  return pid;
}


x86 assembly (clang, -O0):
<run_driftlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xe8f(%rip),%rsi
call   1040 <sprintf@plt>
mov    $0x0,%al
call   1060 <fork@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11a0 <run_driftlog+0x60>
lea    -0x120(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x20(%rbp)
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x1c(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_driftlog>:
sub    $0x108,%rsp
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xea9(%rip),%rsi
mov    %rsp,%rdi
call   1040 <sprintf@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
je     1172 <run_driftlog+0x32>
add    $0x108,%rsp
ret
mov    %rsp,%rdi
call   1030 <system@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"./drift-log.py %s 60 %ld | tee %s\00"
define i32 @run_driftlog(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [256 x i8]
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %4
%12 = load i64, i64* %5
%13 = load i8*, i8** %6
%14 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %11, i64 %12, i8* %13)
%15 = call i32 (...) @fork()
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = icmp ne i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %3
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%20 = call i32 @system(i8* %19)
store i32 %20, i32* %8
%21 = call i32 @exit(i32 0)
unreachable
22: ; preds = %3
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
@.str = [34 x i8] c"./drift-log.py %s 60 %ld | tee %s\00"
define i32 @run_driftlog(i8* %0, i64 %1, i8* %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1, i8* %2)
%7 = tail call i32 (...) @fork()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = call i32 @system(i8* %5)
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %3
ret i32 %7
}