#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 undostack {
  int dummy;
};

/* Variables and functions */
scalar_t__ pushw(struct undostack *, char);
int uputcmd(struct undostack *u, int size, int start, char cmd) {
  return (pushw(u, size) && pushw(u, start) && pushw(u, cmd));
}


x86 assembly (clang, -O0):
<uputcmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
movsbl %al,%esi
call   1030 <pushw@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
je     1180 <uputcmd+0x70>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
movsbl %al,%esi
call   1030 <pushw@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
je     1180 <uputcmd+0x70>
mov    -0x8(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <pushw@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uputcmd>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rdi,%rbx
movsbl %sil,%esi
call   1030 <pushw@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1156 <uputcmd+0x46>
movsbl %r15b,%esi
mov    %rbx,%rdi
call   1030 <pushw@plt>
test   %rax,%rax
je     1156 <uputcmd+0x46>
movsbl %r14b,%esi
mov    %rbx,%rdi
call   1030 <pushw@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.undostack = type { i32 }
define i32 @uputcmd(%struct.undostack* %0, i32 %1, i32 %2, i8 signext %3) {
%5 = alloca %struct.undostack*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store %struct.undostack* %0, %struct.undostack** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8 %3, i8* %8
%9 = load %struct.undostack*, %struct.undostack** %5
%10 = load i32, i32* %6
%11 = trunc i32 %10 to i8
%12 = call i64 @pushw(%struct.undostack* %9, i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %4
%15 = load %struct.undostack*, %struct.undostack** %5
%16 = load i32, i32* %7
%17 = trunc i32 %16 to i8
%18 = call i64 @pushw(%struct.undostack* %15, i8 signext %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %14
%21 = load %struct.undostack*, %struct.undostack** %5
%22 = load i8, i8* %8
%23 = call i64 @pushw(%struct.undostack* %21, i8 signext %22)
%24 = icmp ne i64 %23, 0
br label %25
25: ; preds = %20, %14, %4
%26 = phi i1 [ false, %14 ], [ false, %4 ], [ %24, %20 ]
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
%struct.undostack = type { i32 }
define i32 @uputcmd(%struct.undostack* %0, i32 %1, i32 %2, i8 signext %3) {
%5 = trunc i32 %1 to i8
%6 = tail call i64 @pushw(%struct.undostack* %0, i8 signext %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %4
%9 = trunc i32 %2 to i8
%10 = tail call i64 @pushw(%struct.undostack* %0, i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = tail call i64 @pushw(%struct.undostack* %0, i8 signext %3)
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %8, %4
%17 = phi i32 [ 0, %8 ], [ 0, %4 ], [ %15, %12 ]
ret i32 %17
}