#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 fail_real(int /*<<< orphan*/, int);
int zext_i16to32(int);
int zext_i32to64(int);
int zext_i8to16(int);
int test_zext(void) {
  if (zext_i8to16(-4) != 0xfc)
    return fail_real(0, 595);
  if (zext_i16to32(-4) != 0xfffc)
    return fail_real(0, 597);
  if (zext_i32to64(-4) != 0xfffffffcll)
    return fail_real(0, 599);
  return 0x4000000;
}


x86 assembly (clang, -O0):
<test_zext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xfffffffc,%edi
call   1050 <zext_i8to16@plt>
cmp    $0xfc,%eax
je     1171 <test_zext+0x31>
xor    %edi,%edi
mov    $0x253,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    11cf <test_zext+0x8f>
mov    $0xfffffffc,%edi
call   1030 <zext_i16to32@plt>
cmp    $0xfffc,%eax
je     119a <test_zext+0x5a>
xor    %edi,%edi
mov    $0x255,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    11cf <test_zext+0x8f>
mov    $0xfffffffc,%edi
call   1060 <zext_i32to64@plt>
cltq
mov    $0xfffffffc,%ecx
cmp    %rcx,%rax
je     11c8 <test_zext+0x88>
xor    %edi,%edi
mov    $0x257,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    11cf <test_zext+0x8f>
movl   $0x4000000,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_zext>:
push   %rax
mov    $0xfffffffc,%edi
call   1050 <zext_i8to16@plt>
mov    $0x253,%esi
cmp    $0xfc,%eax
jne    117c <test_zext+0x3c>
mov    $0xfffffffc,%edi
call   1030 <zext_i16to32@plt>
mov    $0x255,%esi
cmp    $0xfffc,%eax
jne    117c <test_zext+0x3c>
mov    $0xfffffffc,%edi
call   1060 <zext_i32to64@plt>
mov    $0x257,%esi
xor    %edi,%edi
pop    %rax
jmp    1040 <fail_real@plt>

LLVM IR (-O0):
define i32 @test_zext() {
%1 = alloca i32
%2 = call i32 @zext_i8to16(i32 -4)
%3 = icmp ne i32 %2, 252
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @fail_real(i32 0, i32 595)
store i32 %5, i32* %1
br label %18
6: ; preds = %0
%7 = call i32 @zext_i16to32(i32 -4)
%8 = icmp ne i32 %7, 65532
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @fail_real(i32 0, i32 597)
store i32 %10, i32* %1
br label %18
11: ; preds = %6
%12 = call i32 @zext_i32to64(i32 -4)
%13 = sext i32 %12 to i64
%14 = icmp ne i64 %13, 4294967292
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @fail_real(i32 0, i32 599)
store i32 %16, i32* %1
br label %18
17: ; preds = %11
store i32 67108864, i32* %1
br label %18
18: ; preds = %17, %15, %9, %4
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @test_zext() {
%1 = tail call i32 @zext_i8to16(i32 -4)
%2 = icmp eq i32 %1, 252
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call i32 @zext_i16to32(i32 -4)
%5 = icmp eq i32 %4, 65532
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @zext_i32to64(i32 -4)
br label %8
8: ; preds = %3, %0, %6
%9 = phi i32 [ 599, %6 ], [ 595, %0 ], [ 597, %3 ]
%10 = tail call i32 @fail_real(i32 0, i32 %9)
ret i32 %10
}