#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 */
scalar_t__ overflow(int, int);
int test_overflow() {
  return overflow(0x7FFFFFFF, 0x00000001) && overflow(0x00000001, 0x7FFFFFFF) &&
         overflow(0x80000000, 0x80000000) && overflow(0x8FFFFFFF, 0x8FFFFFFF);
}


x86 assembly (clang, -O0):
<test_overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x7fffffff,%edi
mov    $0x1,%esi
call   1030 <overflow@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
je     118e <test_overflow+0x7e>
mov    $0x1,%edi
mov    $0x7fffffff,%esi
call   1030 <overflow@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
je     118e <test_overflow+0x7e>
mov    $0x80000000,%esi
mov    %esi,%edi
call   1030 <overflow@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
je     118e <test_overflow+0x7e>
mov    $0x8fffffff,%esi
mov    %esi,%edi
call   1030 <overflow@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_overflow>:
push   %rbx
mov    $0x7fffffff,%edi
mov    $0x1,%esi
call   1030 <overflow@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1166 <test_overflow+0x56>
mov    $0x1,%edi
mov    $0x7fffffff,%esi
call   1030 <overflow@plt>
test   %rax,%rax
je     1166 <test_overflow+0x56>
mov    $0x80000000,%edi
mov    $0x80000000,%esi
call   1030 <overflow@plt>
test   %rax,%rax
je     1166 <test_overflow+0x56>
mov    $0x8fffffff,%edi
mov    $0x8fffffff,%esi
call   1030 <overflow@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_overflow() {
%1 = call i64 @overflow(i32 2147483647, i32 1)
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %12
3: ; preds = %0
%4 = call i64 @overflow(i32 1, i32 2147483647)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = call i64 @overflow(i32 -2147483648, i32 -2147483648)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = call i64 @overflow(i32 -1879048193, i32 -1879048193)
%11 = icmp ne i64 %10, 0
br label %12
12: ; preds = %9, %6, %3, %0
%13 = phi i1 [ false, %6 ], [ false, %3 ], [ false, %0 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @test_overflow() {
%1 = tail call i64 @overflow(i32 2147483647, i32 1)
%2 = icmp eq i64 %1, 0
br i1 %2, label %13, label %3
3: ; preds = %0
%4 = tail call i64 @overflow(i32 1, i32 2147483647)
%5 = icmp eq i64 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i64 @overflow(i32 -2147483648, i32 -2147483648)
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i64 @overflow(i32 -1879048193, i32 -1879048193)
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %3, %0
%14 = phi i32 [ 0, %6 ], [ 0, %3 ], [ 0, %0 ], [ %12, %9 ]
ret i32 %14
}