#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*/ log_err(char *, char const *, int, char const *, int,
                           int /*<<< orphan*/);
int /*<<< orphan*/ nodm_strerror(int);
int /*<<< orphan*/ test_fail();
void _ensure_succeeds(int code, const char *file, int line, const char *desc) {
  if (code != 0) {
    log_err("%s:%d:%s failed with code %d (%s)", file, line, desc, code,
            nodm_strerror(code));
    test_fail();
  }
}


x86 assembly (clang, -O0):
<_ensure_succeeds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1199 <_ensure_succeeds+0x69>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <nodm_strerror@plt>
mov    -0x40(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    %eax,%r9d
lea    0xe73(%rip),%rdi
call   1050 <log_err@plt>
mov    $0x0,%al
call   1030 <test_fail@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ensure_succeeds>:
test   %edi,%edi
je     1177 <_ensure_succeeds+0x47>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <nodm_strerror@plt>
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %eax,%r9d
call   1050 <log_err@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <test_fail@plt>
ret

LLVM IR (-O0):
@.str = [34 x i8] c"%s:%d:%s failed with code %d (%s)\00"
define void @_ensure_succeeds(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %4
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = load i8*, i8** %8
%15 = load i32, i32* %5
%16 = load i32, i32* %5
%17 = call i32 @nodm_strerror(i32 %16)
%18 = call i32 @log_err(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %13, i8* %14, i32 %15, i32 %17)
%19 = call i32 (...) @test_fail()
br label %20
20: ; preds = %11, %4
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"%s:%d:%s failed with code %d (%s)\00"
define void @_ensure_succeeds(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = tail call i32 @nodm_strerror(i32 %0)
%8 = tail call i32 @log_err(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2, i8* %3, i32 %0, i32 %7)
%9 = tail call i32 (...) @test_fail()
br label %10
10: ; preds = %6, %4
ret void
}