#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*/ fprintf(int /*<<< orphan*/, char *, unsigned long);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ ularith_div_2ul_ul_ul_r(unsigned long *, unsigned long,
                                           unsigned long, unsigned long const);
int modredcul_initmod_ul(unsigned long *m, const unsigned long s) {
  if (s == 1UL) {
    *m = 0UL;
  } else {
    *m = 1UL;
    ularith_div_2ul_ul_ul_r(m, 0UL, 1UL, s);
  }
  fprintf(stderr, "m = %lu\n", *m);
  if (sizeof(unsigned long) == 8)
    if (*m != 8241071186)
      return 1;
    else
      return 0;
}


x86 assembly (clang, -O0):
<modredcul_initmod_ul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x1,-0x18(%rbp)
jne    114b <modredcul_initmod_ul+0x2b>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
jmp    116c <modredcul_initmod_ul+0x4c>
mov    -0x10(%rbp),%rax
movq   $0x1,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
call   1040 <ularith_div_2ul_ul_ul_r@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe7d(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
movabs $0x1eb34c452,%rcx
cmp    %rcx,(%rax)
je     11ab <modredcul_initmod_ul+0x8b>
movl   $0x1,-0x4(%rbp)
jmp    11b2 <modredcul_initmod_ul+0x92>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modredcul_initmod_ul>:
push   %rbx
mov    %rdi,%rbx
cmp    $0x1,%rsi
jne    1135 <modredcul_initmod_ul+0x15>
movq   $0x0,(%rbx)
xor    %edx,%edx
jmp    1151 <modredcul_initmod_ul+0x31>
mov    %rsi,%rcx
movq   $0x1,(%rbx)
mov    $0x1,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <ularith_div_2ul_ul_ul_r@plt>
mov    (%rbx),%rdx
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1030 <fprintf@plt>
movabs $0x1eb34c452,%rcx
xor    %eax,%eax
cmp    %rcx,(%rbx)
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [9 x i8] c"m = %lu\0A\00"
define i32 @modredcul_initmod_ul(i64* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64
store i64* %0, i64** %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = icmp eq i64 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64*, i64** %4
store i64 0, i64* %9
br label %15
10: ; preds = %2
%11 = load i64*, i64** %4
store i64 1, i64* %11
%12 = load i64*, i64** %4
%13 = load i64, i64* %5
%14 = call i32 @ularith_div_2ul_ul_ul_r(i64* %12, i64 0, i64 1, i64 %13)
br label %15
15: ; preds = %10, %8
%16 = load i32, i32* @stderr
%17 = load i64*, i64** %4
%18 = load i64, i64* %17
%19 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %18)
%20 = load i64*, i64** %4
%21 = load i64, i64* %20
%22 = icmp ne i64 %21, 8241071186
br i1 %22, label %23, label %24
23: ; preds = %15
store i32 1, i32* %3
br label %25
24: ; preds = %15
store i32 0, i32* %3
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"m = %lu\0A\00"
define i32 @modredcul_initmod_ul(i64* %0, i64 %1) {
%3 = icmp eq i64 %1, 1
br i1 %3, label %4, label %5
4: ; preds = %2
store i64 0, i64* %0
br label %8
5: ; preds = %2
store i64 1, i64* %0
%6 = tail call i32 @ularith_div_2ul_ul_ul_r(i64* %0, i64 0, i64 1, i64 %1)
%7 = load i64, i64* %0
br label %8
8: ; preds = %5, %4
%9 = phi i64 [ %7, %5 ], [ 0, %4 ]
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %9)
%12 = load i64, i64* %0
%13 = icmp ne i64 %12, 8241071186
%14 = zext i1 %13 to i32
ret i32 %14
}