#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*/ time_t;
struct chirp_client {
  int dummy;
};
typedef int int64_t;

/* Variables and functions */
int simple_command(struct chirp_client *, int /*<<< orphan*/, char *, char *);
int ticket_translate(char const *, char *);
int /*<<< orphan*/ unlink(char const *);
int64_t chirp_client_ticket_delete(struct chirp_client *c, const char *name,
                                   time_t stoptime) {
  char ticket_subject[1024];
  if (ticket_translate(name, ticket_subject) == -1)
    return -1;
  int64_t result =
      simple_command(c, stoptime, "ticket_delete %s\n", ticket_subject);
  if (result == 0) {
    unlink(name);
  }
  return result;
}


x86 assembly (clang, -O0):
<chirp_client_ticket_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   1050 <ticket_translate@plt>
cmp    $0xffffffff,%eax
jne    116b <chirp_client_ticket_delete+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    11aa <chirp_client_ticket_delete+0x7a>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x420(%rbp),%rcx
lea    0xe80(%rip),%rdx
call   1040 <simple_command@plt>
mov    %eax,-0x424(%rbp)
cmpl   $0x0,-0x424(%rbp)
jne    11a1 <chirp_client_ticket_delete+0x71>
mov    -0x18(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x424(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_client_ticket_delete>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <ticket_translate@plt>
cmp    $0xffffffff,%eax
je     1179 <chirp_client_ticket_delete+0x49>
lea    0xea5(%rip),%rdx
mov    %rsp,%rcx
mov    %rbp,%rdi
mov    %r14d,%esi
call   1040 <simple_command@plt>
test   %eax,%eax
jne    117e <chirp_client_ticket_delete+0x4e>
mov    %rbx,%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
jmp    117e <chirp_client_ticket_delete+0x4e>
mov    $0xffffffff,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.chirp_client = type { i32 }
@.str = [18 x i8] c"ticket_delete %s\0A\00"
define i32 @chirp_client_ticket_delete(%struct.chirp_client* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.chirp_client*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [1024 x i8]
%9 = alloca i32
store %struct.chirp_client* %0, %struct.chirp_client** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%10 = load i8*, i8** %6
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%12 = call i32 @ticket_translate(i8* %10, i8* %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 -1, i32* %4
br label %27
15: ; preds = %3
%16 = load %struct.chirp_client*, %struct.chirp_client** %5
%17 = load i32, i32* %7
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%19 = call i32 @simple_command(%struct.chirp_client* %16, i32 %17, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %18)
store i32 %19, i32* %9
%20 = load i32, i32* %9
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %15
%23 = load i8*, i8** %6
%24 = call i32 @unlink(i8* %23)
br label %25
25: ; preds = %22, %15
%26 = load i32, i32* %9
store i32 %26, i32* %4
br label %27
27: ; preds = %25, %14
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
%struct.chirp_client = type { i32 }
@.str = [18 x i8] c"ticket_delete %s\0A\00"
define i32 @chirp_client_ticket_delete(%struct.chirp_client* %0, i8* %1, i32 %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = call i32 @ticket_translate(i8* %1, i8* %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = call i32 @simple_command(%struct.chirp_client* %0, i32 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @unlink(i8* %1)
br label %13
13: ; preds = %8, %11, %3
%14 = phi i32 [ -1, %3 ], [ 0, %11 ], [ %9, %8 ]
ret i32 %14
}