#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*/ runes_client_send_kill_daemon_message(int);
int /*<<< orphan*/ runes_client_send_new_term_message(int, int, char **);
char *runes_get_daemon_socket_name();
int /*<<< orphan*/ runes_socket_client_close(int);
int runes_socket_client_open(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *name;
  int s;
  name = runes_get_daemon_socket_name();
  s = runes_socket_client_open(name);
  if (argc > 1 && !strcmp(argv[1], "--kill-daemon")) {
    runes_client_send_kill_daemon_message(s);
  } else {
    runes_client_send_new_term_message(s, argc, argv);
  }
  runes_socket_client_close(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <runes_get_daemon_socket_name@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <runes_socket_client_open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11c1 <main+0x61>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11c1 <main+0x61>
mov    -0x1c(%rbp),%edi
call   1030 <runes_client_send_kill_daemon_message@plt>
jmp    11d0 <main+0x70>
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <runes_client_send_new_term_message@plt>
mov    -0x1c(%rbp),%edi
call   1080 <runes_socket_client_close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
xor    %eax,%eax
call   1070 <runes_get_daemon_socket_name@plt>
mov    %rax,%rdi
call   1060 <runes_socket_client_open@plt>
mov    %eax,%ebp
cmp    $0x2,%ebx
jl     1193 <main+0x33>
mov    0x8(%r14),%rdi
lea    0xe76(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11a1 <main+0x41>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1040 <runes_client_send_new_term_message@plt>
jmp    11a8 <main+0x48>
mov    %ebp,%edi
call   1030 <runes_client_send_kill_daemon_message@plt>
mov    %ebp,%edi
call   1080 <runes_socket_client_close@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"--kill-daemon\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i8* (...) @runes_get_daemon_socket_name()
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 @runes_socket_client_open(i8* %9)
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %22
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %13
%20 = load i32, i32* %7
%21 = call i32 @runes_client_send_kill_daemon_message(i32 %20)
br label %27
22: ; preds = %13, %2
%23 = load i32, i32* %7
%24 = load i32, i32* %4
%25 = load i8**, i8*** %5
%26 = call i32 @runes_client_send_new_term_message(i32 %23, i32 %24, i8** %25)
br label %27
27: ; preds = %22, %19
%28 = load i32, i32* %7
%29 = call i32 @runes_socket_client_close(i32 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"--kill-daemon\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i8* (...) @runes_get_daemon_socket_name()
%4 = tail call i32 @runes_socket_client_open(i8* %3)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @runes_client_send_kill_daemon_message(i32 %4)
br label %15
13: ; preds = %6, %2
%14 = tail call i32 @runes_client_send_new_term_message(i32 %4, i32 %0, i8** %1)
br label %15
15: ; preds = %13, %11
%16 = tail call i32 @runes_socket_client_close(i32 %4)
ret i32 0
}