#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 */
struct menu_item {
  int dummy;
};
struct menu {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
struct menu_item *menu_find(struct menu *, char const *);
int /*<<< orphan*/ menu_setcurritem(struct menu *, struct menu_item *);
void menu_setcurritem_file(struct menu *menu, const char *file) {
  struct menu_item *mi;
  assert(menu != NULL);
  assert(file != NULL);
  mi = menu_find(menu, file);
  if (mi)
    menu_setcurritem(menu, mi);
}


x86 assembly (clang, -O0):
<menu_setcurritem_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <menu_find@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118d <menu_setcurritem_file+0x5d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <menu_setcurritem@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_setcurritem_file>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <menu_find@plt>
test   %rax,%rax
je     1178 <menu_setcurritem_file+0x48>
mov    %rbx,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <menu_setcurritem@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.menu = type { i32 }
%struct.menu_item = type { i32 }
define void @menu_setcurritem_file(%struct.menu* %0, i8* %1) {
%3 = alloca %struct.menu*
%4 = alloca i8*
%5 = alloca %struct.menu_item*
store %struct.menu* %0, %struct.menu** %3
store i8* %1, i8** %4
%6 = load %struct.menu*, %struct.menu** %3
%7 = icmp ne %struct.menu* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load %struct.menu*, %struct.menu** %3
%15 = load i8*, i8** %4
%16 = call %struct.menu_item* @menu_find(%struct.menu* %14, i8* %15)
store %struct.menu_item* %16, %struct.menu_item** %5
%17 = load %struct.menu_item*, %struct.menu_item** %5
%18 = icmp ne %struct.menu_item* %17, null
br i1 %18, label %19, label %23
19: ; preds = %2
%20 = load %struct.menu*, %struct.menu** %3
%21 = load %struct.menu_item*, %struct.menu_item** %5
%22 = call i32 @menu_setcurritem(%struct.menu* %20, %struct.menu_item* %21)
br label %23
23: ; preds = %19, %2
ret void
}

LLVM IR (-O2):
%struct.menu = type { i32 }
%struct.menu_item = type { i32 }
define void @menu_setcurritem_file(%struct.menu* %0, i8* %1) {
%3 = icmp ne %struct.menu* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i8* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call %struct.menu_item* @menu_find(%struct.menu* %0, i8* %1)
%10 = icmp eq %struct.menu_item* %9, null
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = tail call i32 @menu_setcurritem(%struct.menu* %0, %struct.menu_item* %9)
br label %13
13: ; preds = %11, %2
ret void
}