#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 int uint8_t;
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int32_t libgieditor_add_addresses(uint32_t address1, uint32_t address2) {
  uint8_t a1, a2, a3, a4, b1, b2, b3, b4, c1, c2, c3, c4;
  a1 = (address1 & 0xff000000) >> 24;
  b1 = (address2 & 0xff000000) >> 24;
  a2 = (address1 & 0x00ff0000) >> 16;
  b2 = (address2 & 0x00ff0000) >> 16;
  a3 = (address1 & 0x0000ff00) >> 8;
  b3 = (address2 & 0x0000ff00) >> 8;
  a4 = (address1 & 0x000000ff);
  b4 = (address2 & 0x000000ff);
  c4 = a4 + b4;
  c3 = a3 + b3 + ((c4 & 0x80) >> 7);
  c2 = a2 + b2 + ((c3 & 0x80) >> 7);
  c1 = a1 + b1 + ((c2 & 0x80) >> 7);
  c4 &= 0x7f;
  c3 &= 0x7f;
  c2 &= 0x7f;
  c1 &= 0x7f;
  return (c1 << 24 | c2 << 16 | c3 << 8 | c4);
}


x86 assembly (clang, -O0):
<libgieditor_add_addresses>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x14(%rbp),%eax
add    -0x24(%rbp),%eax
mov    -0x38(%rbp),%ecx
and    $0x80,%ecx
sar    $0x7,%ecx
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%eax
add    -0x20(%rbp),%eax
mov    -0x34(%rbp),%ecx
and    $0x80,%ecx
sar    $0x7,%ecx
add    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    -0x30(%rbp),%ecx
and    $0x80,%ecx
sar    $0x7,%ecx
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x38(%rbp),%eax
and    $0x7f,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
and    $0x7f,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
and    $0x7f,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
and    $0x7f,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
shl    $0x18,%eax
mov    -0x30(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x34(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x38(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<libgieditor_add_addresses>:
push   %rbp
push   %rbx
mov    %esi,%eax
mov    %edi,%ecx
mov    %edi,%r9d
movzbl %ch,%ebp
movzbl %cl,%r8d
mov    %edi,%ebx
shr    $0x18,%ebx
movzbl %ah,%edi
movzbl %al,%ecx
mov    %esi,%edx
shr    $0x18,%edx
add    %ebx,%edx
shr    $0x10,%r9d
movzbl %r9b,%eax
shr    $0x10,%esi
movzbl %sil,%esi
add    %eax,%esi
add    %r8d,%ecx
add    %ebp,%edi
mov    %ecx,%eax
shr    $0x7,%eax
and    $0x1,%eax
add    %edi,%eax
mov    %eax,%edi
shr    $0x7,%edi
and    $0x1,%edi
add    %esi,%edi
mov    %edi,%esi
shr    $0x7,%esi
and    $0x1,%esi
add    %edx,%esi
and    $0x7f,%ecx
and    $0x7f,%esi
shl    $0x18,%esi
and    $0x7f,%edi
shl    $0x10,%edi
and    $0x7f,%eax
shl    $0x8,%eax
or     %ecx,%eax
or     %edi,%eax
or     %esi,%eax
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @libgieditor_add_addresses(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%17 = load i32, i32* %3
%18 = and i32 %17, -16777216
%19 = lshr i32 %18, 24
store i32 %19, i32* %5
%20 = load i32, i32* %4
%21 = and i32 %20, -16777216
%22 = lshr i32 %21, 24
store i32 %22, i32* %9
%23 = load i32, i32* %3
%24 = and i32 %23, 16711680
%25 = ashr i32 %24, 16
store i32 %25, i32* %6
%26 = load i32, i32* %4
%27 = and i32 %26, 16711680
%28 = ashr i32 %27, 16
store i32 %28, i32* %10
%29 = load i32, i32* %3
%30 = and i32 %29, 65280
%31 = ashr i32 %30, 8
store i32 %31, i32* %7
%32 = load i32, i32* %4
%33 = and i32 %32, 65280
%34 = ashr i32 %33, 8
store i32 %34, i32* %11
%35 = load i32, i32* %3
%36 = and i32 %35, 255
store i32 %36, i32* %8
%37 = load i32, i32* %4
%38 = and i32 %37, 255
store i32 %38, i32* %12
%39 = load i32, i32* %8
%40 = load i32, i32* %12
%41 = add nsw i32 %39, %40
store i32 %41, i32* %16
%42 = load i32, i32* %7
%43 = load i32, i32* %11
%44 = add nsw i32 %42, %43
%45 = load i32, i32* %16
%46 = and i32 %45, 128
%47 = ashr i32 %46, 7
%48 = add nsw i32 %44, %47
store i32 %48, i32* %15
%49 = load i32, i32* %6
%50 = load i32, i32* %10
%51 = add nsw i32 %49, %50
%52 = load i32, i32* %15
%53 = and i32 %52, 128
%54 = ashr i32 %53, 7
%55 = add nsw i32 %51, %54
store i32 %55, i32* %14
%56 = load i32, i32* %5
%57 = load i32, i32* %9
%58 = add nsw i32 %56, %57
%59 = load i32, i32* %14
%60 = and i32 %59, 128
%61 = ashr i32 %60, 7
%62 = add nsw i32 %58, %61
store i32 %62, i32* %13
%63 = load i32, i32* %16
%64 = and i32 %63, 127
store i32 %64, i32* %16
%65 = load i32, i32* %15
%66 = and i32 %65, 127
store i32 %66, i32* %15
%67 = load i32, i32* %14
%68 = and i32 %67, 127
store i32 %68, i32* %14
%69 = load i32, i32* %13
%70 = and i32 %69, 127
store i32 %70, i32* %13
%71 = load i32, i32* %13
%72 = shl i32 %71, 24
%73 = load i32, i32* %14
%74 = shl i32 %73, 16
%75 = or i32 %72, %74
%76 = load i32, i32* %15
%77 = shl i32 %76, 8
%78 = or i32 %75, %77
%79 = load i32, i32* %16
%80 = or i32 %78, %79
ret i32 %80
}

LLVM IR (-O2):
define i32 @libgieditor_add_addresses(i32 %0, i32 %1) {
%3 = lshr i32 %0, 24
%4 = lshr i32 %1, 24
%5 = lshr i32 %0, 16
%6 = and i32 %5, 255
%7 = lshr i32 %1, 16
%8 = and i32 %7, 255
%9 = lshr i32 %0, 8
%10 = and i32 %9, 255
%11 = lshr i32 %1, 8
%12 = and i32 %11, 255
%13 = and i32 %0, 255
%14 = and i32 %1, 255
%15 = add nuw nsw i32 %14, %13
%16 = add nuw nsw i32 %12, %10
%17 = lshr i32 %15, 7
%18 = and i32 %17, 1
%19 = add nuw nsw i32 %16, %18
%20 = add nuw nsw i32 %8, %6
%21 = lshr i32 %19, 7
%22 = and i32 %21, 1
%23 = add nuw nsw i32 %20, %22
%24 = add nuw nsw i32 %4, %3
%25 = lshr i32 %23, 7
%26 = and i32 %25, 1
%27 = add nuw nsw i32 %24, %26
%28 = and i32 %15, 127
%29 = shl i32 %27, 24
%30 = and i32 %29, 2130706432
%31 = shl nuw nsw i32 %23, 16
%32 = and i32 %31, 8323072
%33 = shl nuw nsw i32 %19, 8
%34 = and i32 %33, 32512
%35 = or i32 %34, %28
%36 = or i32 %35, %32
%37 = or i32 %36, %30
ret i32 %37
}