#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 db_warehouse_delete_product(char *);
int db_warehouse_get_internal_data(char *, void **, int *);
int db_warehouse_set_internal_data(char *, void *, int);
int sequential_delete_product(char *product_name) {
  int ret, size;
  void *st_int;
  ret = db_warehouse_get_internal_data(product_name, &st_int, &size);
  if (ret == 0) {
    st_int = NULL;
    size = 0;
    ret = db_warehouse_set_internal_data(product_name, st_int, size);
  }
  ret = db_warehouse_delete_product(product_name);
  return ret;
}


x86 assembly (clang, -O0):
<sequential_delete_product>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <db_warehouse_get_internal_data@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    117c <sequential_delete_product+0x4c>
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1030 <db_warehouse_set_internal_data@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <db_warehouse_delete_product@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sequential_delete_product>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1040 <db_warehouse_get_internal_data@plt>
test   %eax,%eax
jne    1168 <sequential_delete_product+0x38>
movq   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <db_warehouse_set_internal_data@plt>
mov    %rbx,%rdi
call   1050 <db_warehouse_delete_product@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sequential_delete_product(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @db_warehouse_get_internal_data(i8* %6, i8** %5, i32* %4)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %1
store i8* null, i8** %5
store i32 0, i32* %4
%11 = load i8*, i8** %2
%12 = load i8*, i8** %5
%13 = load i32, i32* %4
%14 = call i32 @db_warehouse_set_internal_data(i8* %11, i8* %12, i32 %13)
store i32 %14, i32* %3
br label %15
15: ; preds = %10, %1
%16 = load i8*, i8** %2
%17 = call i32 @db_warehouse_delete_product(i8* %16)
store i32 %17, i32* %3
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @sequential_delete_product(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = bitcast i32* %2 to i8*
%5 = bitcast i8** %3 to i8*
%6 = call i32 @db_warehouse_get_internal_data(i8* %0, i8** %3, i32* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
store i8* null, i8** %3
store i32 0, i32* %2
%9 = call i32 @db_warehouse_set_internal_data(i8* %0, i8* null, i32 0)
br label %10
10: ; preds = %8, %1
%11 = call i32 @db_warehouse_delete_product(i8* %0)
ret i32 %11
}