#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*/ EINVAL;
int /*<<< orphan*/ ERR_get_error();
int /*<<< orphan*/ errno;
int test_int_eq(char *, int, char *, char *, int /*<<< orphan*/,
                int /*<<< orphan*/);
int preserves_system_error(void) {
  errno = EINVAL;
  ERR_get_error();
  return test_int_eq(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/"
      "humble-video-captive/src/main/gnu/openssl/csrc/test/errtest.c",
      31, "errno", "EINVAL", errno, EINVAL);
}


x86 assembly (clang, -O0):
<preserves_system_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%ecx
mov    0x2eac(%rip),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <ERR_get_error@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%r8d
mov    0x2e8a(%rip),%rax
mov    (%rax),%r9d
lea    0xea8(%rip),%rdi
mov    $0x1f,%esi
lea    0xf5d(%rip),%rdx
lea    0xf5c(%rip),%rcx
call   1030 <test_int_eq@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<preserves_system_error>:
push   %r14
push   %rbx
push   %rax
mov    0x2ead(%rip),%r14
mov    (%r14),%eax
mov    0x2eab(%rip),%rbx
mov    %eax,(%rbx)
xor    %eax,%eax
call   1040 <ERR_get_error@plt>
mov    (%rbx),%r8d
mov    (%r14),%r9d
lea    0xeb5(%rip),%rdi
lea    0xf6f(%rip),%rdx
lea    0xf6e(%rip),%rcx
mov    $0x1f,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <test_int_eq@plt>

LLVM IR (-O0):
@EINVAL = global i32 0
@errno = global i32 0
@.str = [193 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/humble-video-captive/src/main/gnu/openssl/csrc/test/errtest.c\00"
@.str.1 = [6 x i8] c"errno\00"
@.str.2 = [7 x i8] c"EINVAL\00"
define i32 @preserves_system_error() {
%1 = load i32, i32* @EINVAL
store i32 %1, i32* @errno
%2 = call i32 (...) @ERR_get_error()
%3 = load i32, i32* @errno
%4 = load i32, i32* @EINVAL
%5 = call i32 @test_int_eq(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str, i64 0, i64 0), i32 31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
@.str = [193 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/humble-video-captive/src/main/gnu/openssl/csrc/test/errtest.c\00"
@.str.1 = [6 x i8] c"errno\00"
@.str.2 = [7 x i8] c"EINVAL\00"
define i32 @preserves_system_error() {
%1 = load i32, i32* @EINVAL
store i32 %1, i32* @errno
%2 = tail call i32 (...) @ERR_get_error()
%3 = load i32, i32* @errno
%4 = load i32, i32* @EINVAL
%5 = tail call i32 @test_int_eq(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str, i64 0, i64 0), i32 31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %4)
ret i32 %5
}