#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*/ _exit(int);
int /*<<< orphan*/ execlp(char *, char *, char *, char *, char *, char *,
                          char *, char *, char *, char *, char *, char *,
                          char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
void submit(char *prog, char *fabric, char *metric, char *host, char *value) {
  if (!fork()) {
    execlp(prog, prog, "--fabric", fabric, "send_metric", "--appname",
           "traffic", "--metric_name", metric, "--host", host, "--val", value,
           "--metric_type", "GAUGE", NULL);
    _exit(1);
  } else {
    wait(NULL);
  }
}


x86 assembly (clang, -O0):
<submit>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    $0x0,%al
call   1060 <fork@plt>
cmp    $0x0,%eax
jne    1225 <submit+0xe5>
mov    -0x30(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r12
mov    -0x48(%rbp),%r14
mov    -0x50(%rbp),%r11
lea    0xe69(%rip),%rdx
lea    0xe6b(%rip),%r8
lea    0xe70(%rip),%r9
lea    0xe73(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xe70(%rip),%r13
lea    0xe77(%rip),%r15
lea    0xe77(%rip),%rbx
lea    0xe76(%rip),%r10
lea    0xe7d(%rip),%rax
mov    %rax,-0x58(%rbp)
xor    %eax,%eax
mov    -0x60(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x58(%rbp),%rax
mov    %r13,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    %r15,0x18(%rsp)
mov    %r14,0x20(%rsp)
mov    %rbx,0x28(%rsp)
mov    %r11,0x30(%rsp)
mov    %r10,0x38(%rsp)
mov    %rax,0x40(%rsp)
movq   $0x0,0x48(%rsp)
call   1040 <execlp@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <wait@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<submit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r12
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%r13
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
je     117a <submit+0x3a>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <wait@plt>
lea    0xecf(%rip),%rax
lea    0xeba(%rip),%r10
lea    0xead(%rip),%r11
lea    0xe9f(%rip),%rbp
lea    0xe63(%rip),%rdx
lea    0xe65(%rip),%r8
lea    0xe6a(%rip),%r9
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r13,%rcx
push   $0x0
push   %rax
push   %r10
push   %r12
push   %r11
push   %r15
push   %rbp
push   %r14
lea    0xe5e(%rip),%rax
push   %rax
lea    0xe4e(%rip),%rax
push   %rax
call   1040 <execlp@plt>
add    $0x50,%rsp
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"--fabric\00"
@.str.1 = [12 x i8] c"send_metric\00"
@.str.2 = [10 x i8] c"--appname\00"
@.str.3 = [8 x i8] c"traffic\00"
@.str.4 = [14 x i8] c"--metric_name\00"
@.str.5 = [7 x i8] c"--host\00"
@.str.6 = [6 x i8] c"--val\00"
@.str.7 = [14 x i8] c"--metric_type\00"
@.str.8 = [6 x i8] c"GAUGE\00"
define void @submit(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = call i32 (...) @fork()
%12 = icmp ne i32 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %5
%14 = load i8*, i8** %6
%15 = load i8*, i8** %6
%16 = load i8*, i8** %7
%17 = load i8*, i8** %8
%18 = load i8*, i8** %9
%19 = load i8*, i8** %10
%20 = call i32 @execlp(i8* %14, i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* null)
%21 = call i32 @_exit(i32 1)
unreachable
22: ; preds = %5
%23 = call i32 @wait(i32* null)
br label %24
24: ; preds = %22
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"--fabric\00"
@.str.1 = [12 x i8] c"send_metric\00"
@.str.2 = [10 x i8] c"--appname\00"
@.str.3 = [8 x i8] c"traffic\00"
@.str.4 = [14 x i8] c"--metric_name\00"
@.str.5 = [7 x i8] c"--host\00"
@.str.6 = [6 x i8] c"--val\00"
@.str.7 = [14 x i8] c"--metric_type\00"
@.str.8 = [6 x i8] c"GAUGE\00"
define void @submit(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i32 (...) @fork()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i32 @execlp(i8* %0, i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* null)
%10 = tail call i32 @_exit(i32 1)
unreachable
11: ; preds = %5
%12 = tail call i32 @wait(i32* null)
ret void
}