#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 */
typedef scalar_t__ uint32_t;
typedef int int32_t;

/* Variables and functions */
__attribute__((always_)) uint32_t __SADD8(uint32_t x, uint32_t y) {
  int32_t r, s, t, u;
  r = ((((int32_t)x << 24) >> 24) + (((int32_t)y << 24) >> 24)) &
      (int32_t)0x000000FF;
  s = ((((int32_t)x << 16) >> 24) + (((int32_t)y << 16) >> 24)) &
      (int32_t)0x000000FF;
  t = ((((int32_t)x << 8) >> 24) + (((int32_t)y << 8) >> 24)) &
      (int32_t)0x000000FF;
  u = ((((int32_t)x) >> 24) + (((int32_t)y) >> 24)) & (int32_t)0x000000FF;
  return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r)));
}


x86 assembly (clang, -O0):
<__SADD8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x18,%eax
sar    $0x18,%eax
mov    -0x10(%rbp),%rcx
shl    $0x18,%ecx
sar    $0x18,%ecx
add    %ecx,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x10,%eax
sar    $0x18,%eax
mov    -0x10(%rbp),%rcx
shl    $0x10,%ecx
sar    $0x18,%ecx
add    %ecx,%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x8,%eax
sar    $0x18,%eax
mov    -0x10(%rbp),%rcx
shl    $0x8,%ecx
sar    $0x18,%ecx
add    %ecx,%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
sar    $0x18,%eax
mov    -0x10(%rbp),%rcx
sar    $0x18,%ecx
add    %ecx,%eax
and    $0xff,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x18,%eax
mov    -0x1c(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x14(%rbp),%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<__SADD8>:
lea    (%rsi,%rdi,1),%eax
movzbl %al,%eax
mov    %edi,%ecx
and    $0xff00,%ecx
mov    %edi,%edx
and    $0xff0000,%edx
and    $0xff000000,%edi
add    %esi,%edi
and    $0xff000000,%edi
add    %esi,%edx
and    $0xff0000,%edx
or     %edi,%edx
add    %esi,%ecx
and    $0xff00,%ecx
or     %edx,%ecx
or     %eax,%ecx
movslq %ecx,%rax
ret

LLVM IR (-O0):
define i64 @__SADD8(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i64 %0, i64* %3
store i64 %1, i64* %4
%9 = load i64, i64* %3
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 24
%12 = ashr i32 %11, 24
%13 = load i64, i64* %4
%14 = trunc i64 %13 to i32
%15 = shl i32 %14, 24
%16 = ashr i32 %15, 24
%17 = add nsw i32 %12, %16
%18 = and i32 %17, 255
store i32 %18, i32* %5
%19 = load i64, i64* %3
%20 = trunc i64 %19 to i32
%21 = shl i32 %20, 16
%22 = ashr i32 %21, 24
%23 = load i64, i64* %4
%24 = trunc i64 %23 to i32
%25 = shl i32 %24, 16
%26 = ashr i32 %25, 24
%27 = add nsw i32 %22, %26
%28 = and i32 %27, 255
store i32 %28, i32* %6
%29 = load i64, i64* %3
%30 = trunc i64 %29 to i32
%31 = shl i32 %30, 8
%32 = ashr i32 %31, 24
%33 = load i64, i64* %4
%34 = trunc i64 %33 to i32
%35 = shl i32 %34, 8
%36 = ashr i32 %35, 24
%37 = add nsw i32 %32, %36
%38 = and i32 %37, 255
store i32 %38, i32* %7
%39 = load i64, i64* %3
%40 = trunc i64 %39 to i32
%41 = ashr i32 %40, 24
%42 = load i64, i64* %4
%43 = trunc i64 %42 to i32
%44 = ashr i32 %43, 24
%45 = add nsw i32 %41, %44
%46 = and i32 %45, 255
store i32 %46, i32* %8
%47 = load i32, i32* %8
%48 = shl i32 %47, 24
%49 = load i32, i32* %7
%50 = shl i32 %49, 16
%51 = or i32 %48, %50
%52 = load i32, i32* %6
%53 = shl i32 %52, 8
%54 = or i32 %51, %53
%55 = load i32, i32* %5
%56 = or i32 %54, %55
%57 = sext i32 %56 to i64
ret i64 %57
}

LLVM IR (-O2):
define i64 @__SADD8(i64 %0, i64 %1) {
%3 = add i64 %1, %0
%4 = and i64 %3, 255
%5 = and i64 %0, 65280
%6 = and i64 %0, 16711680
%7 = and i64 %0, 4278190080
%8 = add i64 %7, %1
%9 = and i64 %8, 4278190080
%10 = add i64 %6, %1
%11 = and i64 %10, 16711680
%12 = add i64 %5, %1
%13 = and i64 %12, 65280
%14 = or i64 %9, %11
%15 = or i64 %14, %13
%16 = or i64 %15, %4
%17 = shl nuw i64 %16, 32
%18 = ashr exact i64 %17, 32
ret i64 %18
}