#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 EXIT_SUCCESS;
int /*<<< orphan*/ FAIL(char *);
int /*<<< orphan*/ PASS(char *);
int getx();
int /*<<< orphan*/ setx(int);
int main(int argc, const char *argv[]) {
  setx(20);
  if (getx() != 20)
    FAIL("text-reloc");
  else {
    setx(99);
    if (getx() == 99)
      PASS("text-reloc");
    else
      FAIL("text-reloc");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x14,%edi
call   1040 <setx@plt>
mov    $0x0,%al
call   1030 <getx@plt>
cmp    $0x14,%eax
je     1181 <main+0x41>
lea    0xe89(%rip),%rdi
call   1060 <FAIL@plt>
jmp    11bd <main+0x7d>
mov    $0x63,%edi
call   1040 <setx@plt>
mov    $0x0,%al
call   1030 <getx@plt>
cmp    $0x63,%eax
jne    11ac <main+0x6c>
lea    0xe5e(%rip),%rdi
call   1050 <PASS@plt>
jmp    11b8 <main+0x78>
lea    0xe4d(%rip),%rdi
call   1060 <FAIL@plt>
jmp    11bd <main+0x7d>
mov    0x2e1c(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x14,%edi
call   1040 <setx@plt>
xor    %eax,%eax
call   1030 <getx@plt>
cmp    $0x14,%eax
jne    117b <main+0x3b>
mov    $0x63,%edi
call   1040 <setx@plt>
xor    %eax,%eax
call   1030 <getx@plt>
cmp    $0x63,%eax
jne    117b <main+0x3b>
lea    0xe8c(%rip),%rdi
call   1050 <PASS@plt>
jmp    1187 <main+0x47>
lea    0xe7e(%rip),%rdi
call   1060 <FAIL@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"text-reloc\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @setx(i32 20)
%7 = call i32 (...) @getx()
%8 = icmp ne i32 %7, 20
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @FAIL(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %20
11: ; preds = %2
%12 = call i32 @setx(i32 99)
%13 = call i32 (...) @getx()
%14 = icmp eq i32 %13, 99
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @PASS(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %19
17: ; preds = %11
%18 = call i32 @FAIL(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
br label %20
20: ; preds = %19, %9
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}

LLVM IR (-O2):
@.str = [11 x i8] c"text-reloc\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @setx(i32 20)
%4 = tail call i32 (...) @getx()
%5 = icmp eq i32 %4, 20
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @FAIL(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %16
8: ; preds = %2
%9 = tail call i32 @setx(i32 99)
%10 = tail call i32 (...) @getx()
%11 = icmp eq i32 %10, 99
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 @PASS(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %16
14: ; preds = %8
%15 = tail call i32 @FAIL(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %12, %14, %6
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}