#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*/ printf(char *, char const *, char const *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char const *, char const *);
int system(char *);
void start_camera(const char *client, const char *port) {
  char cmd[250];
  int rc;
  sprintf(cmd, "%s %s %s > /dev/null 2>&1 < /dev/null &",
          "/home/root/bin/video-server", client, port);
  rc = system(cmd);
  printf("Start video streaming to %s:%s : %s\n", client, port,
         rc ? "Not ok" : "Ok");
}


x86 assembly (clang, -O0):
<start_camera>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xea7(%rip),%rsi
lea    0xec8(%rip),%rdx
call   1050 <sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x114(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x114(%rbp),%edi
lea    0xee4(%rip),%rcx
lea    0xed6(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_camera>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeb7(%rip),%rsi
lea    0xed8(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rcx
mov    %r14,%r8
call   1050 <sprintf@plt>
mov    %r15,%rdi
call   1030 <system@plt>
test   %eax,%eax
lea    0xefe(%rip),%rax
lea    0xef0(%rip),%rcx
cmove  %rax,%rcx
lea    0xec0(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"%s %s %s > /dev/null 2>&1 < /dev/null &\00"
@.str.1 = [28 x i8] c"/home/root/bin/video-server\00"
@.str.2 = [37 x i8] c"Start video streaming to %s:%s : %s\0A\00"
@.str.3 = [7 x i8] c"Not ok\00"
@.str.4 = [3 x i8] c"Ok\00"
define void @start_camera(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [250 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [250 x i8], [250 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* %9)
%11 = getelementptr inbounds [250 x i8], [250 x i8]* %5, i64 0, i64 0
%12 = call i32 @system(i8* %11)
store i32 %12, i32* %6
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%19 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* %14, i8* %18)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"%s %s %s > /dev/null 2>&1 < /dev/null &\00"
@.str.1 = [28 x i8] c"/home/root/bin/video-server\00"
@.str.2 = [37 x i8] c"Start video streaming to %s:%s : %s\0A\00"
@.str.3 = [7 x i8] c"Not ok\00"
@.str.4 = [3 x i8] c"Ok\00"
define void @start_camera(i8* %0, i8* %1) {
%3 = alloca [250 x i8]
%4 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1)
%6 = call i32 @system(i8* %4)
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1, i8* %8)
ret void
}