#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*/ storeIndexableByte(int, int, int);
int primitiveObject_ByteAt_Put_(int receiver, int *arguments) {
  int index = ((arguments[0] & 0x80000000) ? (((-1 << 31) | arguments[0]) >> 1)
                                           : (arguments[0] >> 1)) -
              1;
  int value = ((arguments[1] & 0x80000000) ? (((-1 << 31) | arguments[1]) >> 1)
                                           : (arguments[1] >> 1));
  storeIndexableByte(receiver, index, value);
  return arguments[1];
}


x86 assembly (clang, -O0):
<primitiveObject_ByteAt_Put_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     1149 <primitiveObject_ByteAt_Put_+0x39>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
or     $0x80000000,%eax
sar    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1155 <primitiveObject_ByteAt_Put_+0x45>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sar    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     118a <primitiveObject_ByteAt_Put_+0x7a>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
or     $0x80000000,%eax
sar    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1197 <primitiveObject_ByteAt_Put_+0x87>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
sar    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <storeIndexableByte@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<primitiveObject_ByteAt_Put_>:
push   %rbx
mov    %rsi,%rbx
mov    (%rsi),%esi
mov    0x4(%rbx),%edx
sar    %edx
sar    %esi
add    $0xffffffff,%esi
call   1030 <storeIndexableByte@plt>
mov    0x4(%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @primitiveObject_ByteAt_Put_(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = and i32 %9, -2147483648
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 0
%15 = load i32, i32* %14
%16 = or i32 -2147483648, %15
%17 = ashr i32 %16, 1
br label %23
18: ; preds = %2
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 0
%21 = load i32, i32* %20
%22 = ashr i32 %21, 1
br label %23
23: ; preds = %18, %12
%24 = phi i32 [ %17, %12 ], [ %22, %18 ]
%25 = sub nsw i32 %24, 1
store i32 %25, i32* %5
%26 = load i32*, i32** %4
%27 = getelementptr inbounds i32, i32* %26, i64 1
%28 = load i32, i32* %27
%29 = and i32 %28, -2147483648
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %23
%32 = load i32*, i32** %4
%33 = getelementptr inbounds i32, i32* %32, i64 1
%34 = load i32, i32* %33
%35 = or i32 -2147483648, %34
%36 = ashr i32 %35, 1
br label %42
37: ; preds = %23
%38 = load i32*, i32** %4
%39 = getelementptr inbounds i32, i32* %38, i64 1
%40 = load i32, i32* %39
%41 = ashr i32 %40, 1
br label %42
42: ; preds = %37, %31
%43 = phi i32 [ %36, %31 ], [ %41, %37 ]
store i32 %43, i32* %6
%44 = load i32, i32* %3
%45 = load i32, i32* %5
%46 = load i32, i32* %6
%47 = call i32 @storeIndexableByte(i32 %44, i32 %45, i32 %46)
%48 = load i32*, i32** %4
%49 = getelementptr inbounds i32, i32* %48, i64 1
%50 = load i32, i32* %49
ret i32 %50
}

LLVM IR (-O2):
define i32 @primitiveObject_ByteAt_Put_(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = getelementptr inbounds i32, i32* %1, i64 1
%5 = load i32, i32* %4
%6 = ashr i32 %5, 1
%7 = ashr i32 %3, 1
%8 = add nsw i32 %7, -1
%9 = tail call i32 @storeIndexableByte(i32 %0, i32 %8, i32 %6)
%10 = load i32, i32* %4
ret i32 %10
}