#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*/ pspeak(short, int);
int /*<<< orphan*/ rspeak(short);
scalar_t__ toting(int);
void inventory(void) {
  auto short msg;
  auto short i;
  msg = 98;
  for (i = 1; i <= 100; ++i) {
    if (i == 35 || !toting(i))
      continue;
    if (msg)
      rspeak(99);
    msg = 0;
    pspeak(i, -1);
  }
  if (toting(35))
    msg = 141;
  if (msg)
    rspeak(msg);
  return;
}


x86 assembly (clang, -O0):
<inventory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x62,-0x2(%rbp)
movw   $0x1,-0x4(%rbp)
movswl -0x4(%rbp),%eax
cmp    $0x64,%eax
jg     11b0 <inventory+0x80>
movswl -0x4(%rbp),%eax
cmp    $0x23,%eax
je     1171 <inventory+0x41>
movswl -0x4(%rbp),%edi
call   1050 <toting@plt>
cmp    $0x0,%rax
jne    1176 <inventory+0x46>
jmp    119f <inventory+0x6f>
cmpw   $0x0,-0x2(%rbp)
je     118b <inventory+0x5b>
mov    $0x63,%edi
call   1030 <rspeak@plt>
movw   $0x0,-0x2(%rbp)
mov    $0xffffffff,%esi
movswl -0x4(%rbp),%edi
call   1040 <pspeak@plt>
mov    -0x4(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x4(%rbp)
jmp    1144 <inventory+0x14>
mov    $0x23,%edi
call   1050 <toting@plt>
cmp    $0x0,%rax
je     11ca <inventory+0x9a>
movw   $0x8d,-0x2(%rbp)
cmpw   $0x0,-0x2(%rbp)
je     11de <inventory+0xae>
movswl -0x2(%rbp),%edi
call   1030 <rspeak@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inventory>:
push   %rbp
push   %rbx
push   %rax
mov    $0x62,%bp
mov    $0x1,%ebx
jmp    1157 <inventory+0x27>
xchg   %ax,%ax
movswl %bx,%edi
mov    $0xffffffff,%esi
call   1040 <pspeak@plt>
xor    %ebp,%ebp
add    $0x1,%ebx
cmp    $0x65,%ebx
je     1179 <inventory+0x49>
cmp    $0x23,%ebx
je     114f <inventory+0x1f>
mov    %ebx,%edi
call   1050 <toting@plt>
test   %rax,%rax
je     114f <inventory+0x1f>
test   %bp,%bp
je     1140 <inventory+0x10>
mov    $0x63,%edi
call   1030 <rspeak@plt>
jmp    1140 <inventory+0x10>
mov    $0x23,%edi
call   1050 <toting@plt>
test   %rax,%rax
mov    $0x8d,%eax
cmove  %ebp,%eax
test   %ax,%ax
je     11a1 <inventory+0x71>
movswl %ax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <rspeak@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @inventory() {
%1 = alloca i16
%2 = alloca i16
store i16 98, i16* %1
store i16 1, i16* %2
br label %3
3: ; preds = %25, %0
%4 = load i16, i16* %2
%5 = sext i16 %4 to i32
%6 = icmp sle i32 %5, 100
br i1 %6, label %7, label %28
7: ; preds = %3
%8 = load i16, i16* %2
%9 = sext i16 %8 to i32
%10 = icmp eq i32 %9, 35
br i1 %10, label %16, label %11
11: ; preds = %7
%12 = load i16, i16* %2
%13 = sext i16 %12 to i32
%14 = call i64 @toting(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %11, %7
br label %25
17: ; preds = %11
%18 = load i16, i16* %1
%19 = icmp ne i16 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @rspeak(i16 signext 99)
br label %22
22: ; preds = %20, %17
store i16 0, i16* %1
%23 = load i16, i16* %2
%24 = call i32 @pspeak(i16 signext %23, i32 -1)
br label %25
25: ; preds = %22, %16
%26 = load i16, i16* %2
%27 = add i16 %26, 1
store i16 %27, i16* %2
br label %3
28: ; preds = %3
%29 = call i64 @toting(i32 35)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %28
store i16 141, i16* %1
br label %32
32: ; preds = %31, %28
%33 = load i16, i16* %1
%34 = icmp ne i16 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i16, i16* %1
%37 = call i32 @rspeak(i16 signext %36)
br label %38
38: ; preds = %35, %32
ret void
}

LLVM IR (-O2):
define void @inventory() {
br label %1
1: ; preds = %0, %15
%2 = phi i32 [ 1, %0 ], [ %17, %15 ]
%3 = phi i16 [ 98, %0 ], [ %16, %15 ]
%4 = icmp eq i32 %2, 35
br i1 %4, label %15, label %5
5: ; preds = %1
%6 = tail call i64 @toting(i32 %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %5
%9 = icmp eq i16 %3, 0
br i1 %9, label %12, label %10
10: ; preds = %8
%11 = tail call i32 @rspeak(i16 signext 99)
br label %12
12: ; preds = %10, %8
%13 = trunc i32 %2 to i16
%14 = tail call i32 @pspeak(i16 signext %13, i32 -1)
br label %15
15: ; preds = %1, %5, %12
%16 = phi i16 [ %3, %1 ], [ 0, %12 ], [ %3, %5 ]
%17 = add nuw nsw i32 %2, 1
%18 = icmp eq i32 %17, 101
br i1 %18, label %19, label %1
19: ; preds = %15
%20 = tail call i64 @toting(i32 35)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i16 %16, i16 141
%23 = icmp eq i16 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %19
%25 = tail call i32 @rspeak(i16 signext %22)
br label %26
26: ; preds = %24, %19
ret void
}