#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*/ assert(char *);
scalar_t__ kitsune_get_val(char *);
int /*<<< orphan*/ kitsune_is_updating();
scalar_t__ strcmp(char *, char const *);
int kitsune_is_updating_from(const char *pt) {
  if (!kitsune_is_updating())
    return 0;
  char *prev_pt = *(char **)kitsune_get_val("update_pt");
  assert(prev_pt);
  return strcmp(prev_pt, pt) == 0;
}


x86 assembly (clang, -O0):
<kitsune_is_updating_from>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <kitsune_is_updating@plt>
cmp    $0x0,%eax
jne    1168 <kitsune_is_updating_from+0x28>
movl   $0x0,-0x4(%rbp)
jmp    11a0 <kitsune_is_updating_from+0x60>
lea    0xe91(%rip),%rdi
call   1060 <kitsune_get_val@plt>
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kitsune_is_updating_from>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <kitsune_is_updating@plt>
test   %eax,%eax
je     117e <kitsune_is_updating_from+0x3e>
lea    0xea6(%rip),%rdi
call   1060 <kitsune_get_val@plt>
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1050 <assert@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"update_pt\00"
define i32 @kitsune_is_updating_from(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = call i32 (...) @kitsune_is_updating()
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 0, i32* %2
br label %19
8: ; preds = %1
%9 = call i64 @kitsune_get_val(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = inttoptr i64 %9 to i8**
%11 = load i8*, i8** %10
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = call i32 @assert(i8* %12)
%14 = load i8*, i8** %4
%15 = load i8*, i8** %3
%16 = call i64 @strcmp(i8* %14, i8* %15)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
store i32 %18, i32* %2
br label %19
19: ; preds = %8, %7
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@.str = [10 x i8] c"update_pt\00"
define i32 @kitsune_is_updating_from(i8* %0) {
%2 = tail call i32 (...) @kitsune_is_updating()
%3 = icmp eq i32 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = tail call i64 @kitsune_get_val(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = inttoptr i64 %5 to i8**
%7 = load i8*, i8** %6
%8 = tail call i32 @assert(i8* %7)
%9 = tail call i64 @strcmp(i8* %7, i8* %0)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %1, %4
%13 = phi i32 [ %11, %4 ], [ 0, %1 ]
ret i32 %13
}