#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 *, char *);
int system(char *);
pid_t run_ntpd(void) {
  pid_t pid;
  int ret;
  char buf[256];
  sprintf(buf, "ntpd -n  -c %s -f %s", "/tmp/myntp.conf", "/tmp/myntp.drift");
  pid = fork();
  if (!pid) {
    ret = system(buf);
    exit(0);
  }
  return pid;
}


x86 assembly (clang, -O0):
<run_ntpd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    -0x110(%rbp),%rdi
lea    0xea7(%rip),%rsi
lea    0xeb5(%rip),%rdx
lea    0xebe(%rip),%rcx
call   1040 <sprintf@plt>
mov    $0x0,%al
call   1060 <fork@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1196 <run_ntpd+0x56>
lea    -0x110(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x8(%rbp)
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_ntpd>:
sub    $0x108,%rsp
lea    0xeb2(%rip),%rsi
lea    0xec0(%rip),%rdx
lea    0xec9(%rip),%rcx
mov    %rsp,%rdi
call   1040 <sprintf@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
je     1177 <run_ntpd+0x37>
add    $0x108,%rsp
ret
mov    %rsp,%rdi
call   1030 <system@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"ntpd -n -c %s -f %s\00"
@.str.1 = [16 x i8] c"/tmp/myntp.conf\00"
@.str.2 = [17 x i8] c"/tmp/myntp.drift\00"
define i32 @run_ntpd() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 (...) @fork()
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%11 = call i32 @system(i8* %10)
store i32 %11, i32* %2
%12 = call i32 @exit(i32 0)
unreachable
13: ; preds = %0
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [21 x i8] c"ntpd -n -c %s -f %s\00"
@.str.1 = [16 x i8] c"/tmp/myntp.conf\00"
@.str.2 = [17 x i8] c"/tmp/myntp.drift\00"
define i32 @run_ntpd() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 (...) @fork()
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @system(i8* %2)
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %0
ret i32 %4
}