#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*/ memset(unsigned char *, int, int);
int rustsecp256k1_v0_3_1_testrand_bits(int);
int recovery_test_nonce_function(unsigned char *nonce32,
                                 const unsigned char *msg32,
                                 const unsigned char *key32,
                                 const unsigned char *algo16, void *data,
                                 unsigned int counter) {
  (void)msg32;
  (void)key32;
  (void)algo16;
  (void)data;
  if (counter == 0) {
    memset(nonce32, 0, 32);
    return 1;
  }
  if (counter == 1) {
    memset(nonce32, 0xff, 32);
    return 1;
  }
  memset(nonce32, 1, 32);
  return rustsecp256k1_v0_3_1_testrand_bits(1);
}


x86 assembly (clang, -O0):
<recovery_test_nonce_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1166 <recovery_test_nonce_function+0x46>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
movl   $0x1,-0x4(%rbp)
jmp    11af <recovery_test_nonce_function+0x8f>
cmpl   $0x1,-0x34(%rbp)
jne    118f <recovery_test_nonce_function+0x6f>
mov    -0x10(%rbp),%rdi
mov    $0xff,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
movl   $0x1,-0x4(%rbp)
jmp    11af <recovery_test_nonce_function+0x8f>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x1,%edi
call   1040 <rustsecp256k1_v0_3_1_testrand_bits@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recovery_test_nonce_function>:
push   %rax
cmp    $0x1,%r9d
je     1130 <recovery_test_nonce_function+0x10>
test   %r9d,%r9d
jne    1146 <recovery_test_nonce_function+0x26>
xor    %esi,%esi
jmp    1135 <recovery_test_nonce_function+0x15>
mov    $0xff,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x1,%eax
pop    %rcx
ret
mov    $0x1,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <rustsecp256k1_v0_3_1_testrand_bits@plt>

LLVM IR (-O0):
define i32 @recovery_test_nonce_function(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i32 %5, i32* %13
%14 = load i8*, i8** %9
%15 = load i8*, i8** %10
%16 = load i8*, i8** %11
%17 = load i8*, i8** %12
%18 = load i32, i32* %13
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %6
%21 = load i8*, i8** %8
%22 = call i32 @memset(i8* %21, i32 0, i32 32)
store i32 1, i32* %7
br label %33
23: ; preds = %6
%24 = load i32, i32* %13
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i8*, i8** %8
%28 = call i32 @memset(i8* %27, i32 255, i32 32)
store i32 1, i32* %7
br label %33
29: ; preds = %23
%30 = load i8*, i8** %8
%31 = call i32 @memset(i8* %30, i32 1, i32 32)
%32 = call i32 @rustsecp256k1_v0_3_1_testrand_bits(i32 1)
store i32 %32, i32* %7
br label %33
33: ; preds = %29, %26, %20
%34 = load i32, i32* %7
ret i32 %34
}

LLVM IR (-O2):
define i32 @recovery_test_nonce_function(i8* %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4, i32 %5) {
switch i32 %5, label %11 [
i32 0, label %7
i32 1, label %9
]
7: ; preds = %6
%8 = tail call i32 @memset(i8* %0, i32 0, i32 32)
br label %14
9: ; preds = %6
%10 = tail call i32 @memset(i8* %0, i32 255, i32 32)
br label %14
11: ; preds = %6
%12 = tail call i32 @memset(i8* %0, i32 1, i32 32)
%13 = tail call i32 @rustsecp256k1_v0_3_1_testrand_bits(i32 1)
br label %14
14: ; preds = %11, %9, %7
%15 = phi i32 [ 1, %7 ], [ 1, %9 ], [ %13, %11 ]
ret i32 %15
}