#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*/ assertTrue(char *, int);
int do_neg(int);
void test_unsigned_neg() {
  assertTrue("do_neg(128) == 0x80", do_neg(128) == 0x80);
  ;
  assertTrue("do_neg(255) == 0x01", do_neg(255) == 0x01);
  ;
  assertTrue("do_neg(64) == 0xC0", do_neg(64) == 0xC0);
  ;
}


x86 assembly (clang, -O0):
<test_unsigned_neg>:
push   %rbp
mov    %rsp,%rbp
mov    $0x80,%edi
call   1040 <do_neg@plt>
cmp    $0x80,%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xebe(%rip),%rdi
call   1030 <assertTrue@plt>
mov    $0xff,%edi
call   1040 <do_neg@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xeb1(%rip),%rdi
call   1030 <assertTrue@plt>
mov    $0x40,%edi
call   1040 <do_neg@plt>
cmp    $0xc0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xea2(%rip),%rdi
call   1030 <assertTrue@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_unsigned_neg>:
push   %rax
mov    $0x80,%edi
call   1040 <do_neg@plt>
xor    %esi,%esi
cmp    $0x80,%eax
sete   %sil
lea    0xec3(%rip),%rdi
call   1030 <assertTrue@plt>
mov    $0xff,%edi
call   1040 <do_neg@plt>
xor    %esi,%esi
cmp    $0x1,%eax
sete   %sil
lea    0xeb8(%rip),%rdi
call   1030 <assertTrue@plt>
mov    $0x40,%edi
call   1040 <do_neg@plt>
xor    %esi,%esi
cmp    $0xc0,%eax
sete   %sil
lea    0xeab(%rip),%rdi
pop    %rax
jmp    1030 <assertTrue@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"do_neg(128) == 0x80\00"
@.str.1 = [20 x i8] c"do_neg(255) == 0x01\00"
@.str.2 = [19 x i8] c"do_neg(64) == 0xC0\00"
define void @test_unsigned_neg() {
%1 = call i32 @do_neg(i32 128)
%2 = icmp eq i32 %1, 128
%3 = zext i1 %2 to i32
%4 = call i32 @assertTrue(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @do_neg(i32 255)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @assertTrue(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @do_neg(i32 64)
%10 = icmp eq i32 %9, 192
%11 = zext i1 %10 to i32
%12 = call i32 @assertTrue(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"do_neg(128) == 0x80\00"
@.str.1 = [20 x i8] c"do_neg(255) == 0x01\00"
@.str.2 = [19 x i8] c"do_neg(64) == 0xC0\00"
define void @test_unsigned_neg() {
%1 = tail call i32 @do_neg(i32 128)
%2 = icmp eq i32 %1, 128
%3 = zext i1 %2 to i32
%4 = tail call i32 @assertTrue(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @do_neg(i32 255)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = tail call i32 @assertTrue(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 @do_neg(i32 64)
%10 = icmp eq i32 %9, 192
%11 = zext i1 %10 to i32
%12 = tail call i32 @assertTrue(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret void
}