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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ init_uint32_t(int *, char const **);
int /*<<< orphan*/ stderr;
int __attribute__((__unused__))
init_uint16_t(uint16_t *u16, const char *argv[]) {
  uint32_t u32;
  init_uint32_t(&u32, argv);
  if (u32 > 0xFFFF)
    do {
      fprintf(stderr, "FATAL[%s:%d]: ",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/0mark/linux-sunxi/refs/heads/"
              "2.6.34.15-mali19/drivers/amlogic/wifi/nano_c047_12/userspace/"
              "libnrx/autotest/testprogram.in.c",
              118);
      fprintf(stderr, "Overflow: Number larger than 0xFFFF (%s)\n", *argv);
      return -1;
    } while (0);
  *u16 = u32;
  return 1;
}


x86 assembly (clang, -O0):
<init_uint16_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdi
call   1030 <init_uint32_t@plt>
cmpl   $0xffff,-0x1c(%rbp)
jle    119c <init_uint16_t+0x7c>
jmp    114f <init_uint16_t+0x2f>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xea1(%rip),%rsi
lea    0xea9(%rip),%rdx
mov    $0x76,%ecx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xf5b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ac <init_uint16_t+0x8c>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_uint16_t>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x4(%rsp),%rdi
call   1030 <init_uint32_t@plt>
mov    0x4(%rsp),%eax
cmp    $0x10000,%eax
jl     117e <init_uint16_t+0x5e>
mov    0x2e9a(%rip),%r14
mov    (%r14),%edi
lea    0xeb0(%rip),%rsi
lea    0xeb8(%rip),%rdx
mov    $0x76,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xf74(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1186 <init_uint16_t+0x66>
mov    %eax,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"FATAL[%s:%d]: \00"
@.str.1 = [213 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/0mark/linux-sunxi/refs/heads/2.6.34.15-mali19/drivers/amlogic/wifi/nano_c047_12/userspace/libnrx/autotest/testprogram.in.c\00"
@.str.2 = [42 x i8] c"Overflow: Number larger than 0xFFFF (%s)\0A\00"
define i32 @init_uint16_t(i32* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8**
%6 = alloca i32
store i32* %0, i32** %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = call i32 @init_uint32_t(i32* %6, i8** %7)
%9 = load i32, i32* %6
%10 = icmp sgt i32 %9, 65535
br i1 %10, label %11, label %20
11: ; preds = %2
br label %12
12: ; preds = %11
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([213 x i8], [213 x i8]* @.str.1, i64 0, i64 0), i32 118)
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %17)
store i32 -1, i32* %3
br label %23
19: ; No predecessors!
br label %20
20: ; preds = %19, %2
%21 = load i32, i32* %6
%22 = load i32*, i32** %4
store i32 %21, i32* %22
store i32 1, i32* %3
br label %23
23: ; preds = %20, %12
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"FATAL[%s:%d]: \00"
@.str.1 = [213 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/0mark/linux-sunxi/refs/heads/2.6.34.15-mali19/drivers/amlogic/wifi/nano_c047_12/userspace/libnrx/autotest/testprogram.in.c\00"
@.str.2 = [42 x i8] c"Overflow: Number larger than 0xFFFF (%s)\0A\00"
define i32 @init_uint16_t(i32* nocapture writeonly %0, i8** %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @init_uint32_t(i32* %3, i8** %1)
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 65535
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([213 x i8], [213 x i8]* @.str.1, i64 0, i64 0), i32 118)
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %12)
br label %15
14: ; preds = %2
store i32 %6, i32* %0
br label %15
15: ; preds = %14, %8
%16 = phi i32 [ -1, %8 ], [ 1, %14 ]
ret i32 %16
}