#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*/ printf(char *, unsigned long);
int /*<<< orphan*/ puts(char *);
unsigned long rtmabortcnt();
unsigned long rtminit();
int /*<<< orphan*/ rtmxbegin();
int /*<<< orphan*/ rtmxend();
int main(void) {
  unsigned long ret;
  ret = rtminit();
  printf("rtminit:%lu\n", ret);
  if (ret)
    return 1;
  ret = rtmabortcnt();
  printf("rtmabortcnt:%lu\n", ret);
  rtmxbegin();
  puts("begun");
  rtmxend();
  puts("ended");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <rtminit@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
je     11a1 <main+0x41>
movl   $0x1,-0x4(%rbp)
jmp    11e9 <main+0x89>
mov    $0x0,%al
call   1060 <rtmabortcnt@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <rtmxbegin@plt>
lea    0xe54(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <rtmxend@plt>
lea    0xe47(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1070 <rtminit@plt>
mov    %rax,%rbx
lea    0xe8e(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    $0x1,%eax
test   %rbx,%rbx
je     1186 <main+0x26>
pop    %rbx
ret
xor    %eax,%eax
call   1060 <rtmabortcnt@plt>
lea    0xe79(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <rtmxbegin@plt>
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <rtmxend@plt>
lea    0xe67(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"rtminit:%lu\0A\00"
@.str.1 = [17 x i8] c"rtmabortcnt:%lu\0A\00"
@.str.2 = [6 x i8] c"begun\00"
@.str.3 = [6 x i8] c"ended\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i64 (...) @rtminit()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %4)
%6 = load i64, i64* %2
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 1, i32* %1
br label %17
9: ; preds = %0
%10 = call i64 (...) @rtmabortcnt()
store i64 %10, i64* %2
%11 = load i64, i64* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64 %11)
%13 = call i32 (...) @rtmxbegin()
%14 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (...) @rtmxend()
%16 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %17
17: ; preds = %9, %8
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [13 x i8] c"rtminit:%lu\0A\00"
@.str.1 = [17 x i8] c"rtmabortcnt:%lu\0A\00"
@.str.2 = [6 x i8] c"begun\00"
@.str.3 = [6 x i8] c"ended\00"
define i32 @main() {
%1 = tail call i64 (...) @rtminit()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %1)
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %0
%5 = tail call i64 (...) @rtmabortcnt()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64 %5)
%7 = tail call i32 (...) @rtmxbegin()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 (...) @rtmxend()
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %0, %4
%12 = phi i32 [ 0, %4 ], [ 1, %0 ]
ret i32 %12
}