#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*/ currTime();
int efSet(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ getpid();
int parseId(char *);
int /*<<< orphan*/ pexit(char *);
int /*<<< orphan*/ printf(char *, long, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
void setEventFlag(char *id) {
  int semId;
  semId = parseId(id);
  if (semId == -1) {
    fprintf(stderr, "Invalid event flag identifier: %s\n", id);
    return;
  }
  if (efSet(semId) == -1)
    pexit("efSet");
  else
    printf("[%ld][%s] %d: set\n", (long)getpid(), currTime(), semId);
}


x86 assembly (clang, -O0):
<setEventFlag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <parseId@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    11b0 <setEventFlag+0x40>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe5a(%rip),%rsi
call   1070 <fprintf@plt>
jmp    11f9 <setEventFlag+0x89>
mov    -0xc(%rbp),%edi
call   1080 <efSet@plt>
cmp    $0xffffffff,%eax
jne    11d2 <setEventFlag+0x62>
lea    0xe5b(%rip),%rdi
call   1090 <pexit@plt>
jmp    11f9 <setEventFlag+0x89>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <currTime@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
mov    -0xc(%rbp),%ecx
lea    0xe35(%rip),%rdi
call   1060 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setEventFlag>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <parseId@plt>
cmp    $0xffffffff,%eax
je     11b8 <setEventFlag+0x48>
mov    %eax,%ebp
mov    %eax,%edi
call   1080 <efSet@plt>
cmp    $0xffffffff,%eax
je     11d6 <setEventFlag+0x66>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <currTime@plt>
lea    0xe83(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <printf@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <fprintf@plt>
lea    0xe46(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1090 <pexit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Invalid event flag identifier: %s\0A\00"
@.str.1 = [6 x i8] c"efSet\00"
@.str.2 = [19 x i8] c"[%ld][%s] %d: set\0A\00"
define void @setEventFlag(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @parseId(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %23
12: ; preds = %1
%13 = load i32, i32* %3
%14 = call i32 @efSet(i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @pexit(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %23
18: ; preds = %12
%19 = call i64 (...) @getpid()
%20 = call i32 (...) @currTime()
%21 = load i32, i32* %3
%22 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %19, i32 %20, i32 %21)
br label %23
23: ; preds = %8, %18, %16
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Invalid event flag identifier: %s\0A\00"
@.str.1 = [6 x i8] c"efSet\00"
@.str.2 = [19 x i8] c"[%ld][%s] %d: set\0A\00"
define void @setEventFlag(i8* %0) {
%2 = tail call i32 @parseId(i8* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %16
7: ; preds = %1
%8 = tail call i32 @efSet(i32 %2)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @pexit(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %16
12: ; preds = %7
%13 = tail call i64 (...) @getpid()
%14 = tail call i32 (...) @currTime()
%15 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %13, i32 %14, i32 %2)
br label %16
16: ; preds = %10, %12, %4
ret void
}