xunge/DecIR huggingface dataset:
/* Variables and functions */
int FD_CLOEXEC;
int /*<<< orphan*/ F_GETFD;
int /*<<< orphan*/ F_SETFD;
int fcntl(int, int /*<<< orphan*/, int);
int close_on_exec(int fileno) {
  int result = fcntl(fileno, F_GETFD, 0);
  if (result < 0)
    return result;
  return fcntl(fileno, F_SETFD, result | FD_CLOEXEC);
}


x86 assembly (clang, -O0):
<close_on_exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1146 <close_on_exec+0x36>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1166 <close_on_exec+0x56>
mov    -0x8(%rbp),%edi
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
mov    0x2e7c(%rip),%rax
or     (%rax),%edx
call   1030 <fcntl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_on_exec>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
test   %eax,%eax
js     1143 <close_on_exec+0x33>
mov    0x2eb2(%rip),%rcx
mov    (%rcx),%esi
mov    0x2ea1(%rip),%rcx
mov    (%rcx),%edx
or     %eax,%edx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <fcntl@plt>
pop    %rbx
ret

LLVM IR (-O0):
@F_GETFD = global i32 0
@F_SETFD = global i32 0
@FD_CLOEXEC = global i32 0
define i32 @close_on_exec(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = load i32, i32* @F_GETFD
%7 = call i32 @fcntl(i32 %5, i32 %6, i32 0)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %19
12: ; preds = %1
%13 = load i32, i32* %3
%14 = load i32, i32* @F_SETFD
%15 = load i32, i32* %4
%16 = load i32, i32* @FD_CLOEXEC
%17 = or i32 %15, %16
%18 = call i32 @fcntl(i32 %13, i32 %14, i32 %17)
store i32 %18, i32* %2
br label %19
19: ; preds = %12, %10
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@F_GETFD = global i32 0
@F_SETFD = global i32 0
@FD_CLOEXEC = global i32 0
define i32 @close_on_exec(i32 %0) {
%2 = load i32, i32* @F_GETFD
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
%4 = icmp slt i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = load i32, i32* @F_SETFD
%7 = load i32, i32* @FD_CLOEXEC
%8 = or i32 %7, %3
%9 = tail call i32 @fcntl(i32 %0, i32 %6, i32 %8)
br label %10
10: ; preds = %1, %5
%11 = phi i32 [ %9, %5 ], [ %3, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *sumP(void *x) {
  int k = 10;
  int sum, i;
  i = 0;
  while (i < k) {
    i++;
    sum += i;
  }
  printf("%d\n", sum);
}


x86 assembly (clang, -O0):
<sumP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    114d <sumP+0x3d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    112a <sumP+0x1a>
mov    -0x18(%rbp),%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumP>:
lea    0xee9(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i8* @sumP(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 10, i32* %4
store i32 0, i32* %6
br label %7
7: ; preds = %11, %1
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 1
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = add nsw i32 %15, %14
store i32 %16, i32* %5
br label %7
17: ; preds = %7
%18 = load i32, i32* %5
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define noalias i8* @sumP(i8* nocapture readnone %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i8* undef
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ btrack(int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  int n = 0;
  if (argc != 2) {
    printf("Usage: %s <int>\n", argv[0]);
    return 1;
  }
  n = atoi(argv[1]);
  btrack(n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1176 <main+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1195 <main+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <btrack@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    114a <main+0x1a>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1030 <btrack@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    (%rsi),%rsi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Usage: %s <int>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 1, i32* %3
br label %21
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = call i32 @btrack(i32 %19)
store i32 0, i32* %3
br label %21
21: ; preds = %14, %9
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [17 x i8] c"Usage: %s <int>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %12
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = tail call i32 @btrack(i32 %10)
br label %12
12: ; preds = %7, %4
%13 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %13
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t SSIIntStatus(uint32_t ui32Base, bool bMasked) {
  ;
  if (bMasked) {
    return ((*((volatile unsigned long *)(ui32Base + 0x0000001C))));
  } else {
    return ((*((volatile unsigned long *)(ui32Base + 0x00000018))));
  }
}


x86 assembly (clang, -O0):
<SSIIntStatus>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1126 <SSIIntStatus+0x26>
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1132 <SSIIntStatus+0x32>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIIntStatus>:
mov    %rdi,-0x8(%rsp)
xor    %eax,%eax
test   %esi,%esi
setne  %al
mov    -0x8(%rsp),%rcx
mov    0x18(%rcx,%rax,4),%rax
ret

LLVM IR (-O0):
define i64 @SSIIntStatus(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
store volatile i64 %0, i64* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load volatile i64, i64* %4
%10 = add i64 %9, 28
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
store i64 %12, i64* %3
br label %18
13: ; preds = %2
%14 = load volatile i64, i64* %4
%15 = add i64 %14, 24
%16 = inttoptr i64 %15 to i64*
%17 = load volatile i64, i64* %16
store i64 %17, i64* %3
br label %18
18: ; preds = %13, %8
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
define i64 @SSIIntStatus(i64 %0, i32 %1) {
%3 = alloca i64
store volatile i64 %0, i64* %3
%4 = icmp eq i32 %1, 0
%5 = load volatile i64, i64* %3
%6 = select i1 %4, i64 24, i64 28
%7 = add i64 %5, %6
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ closeFramebuffer();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ signal(int, int /*<<< orphan*/);
void INThandler(int sig) {
  signal(sig, SIG_IGN);
  closeFramebuffer();
  exit(0);
}


x86 assembly (clang, -O0):
<INThandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    $0x0,%al
call   1030 <closeFramebuffer@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<INThandler>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
xor    %eax,%eax
call   1030 <closeFramebuffer@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SIG_IGN = global i32 0
define void @INThandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIG_IGN
%5 = call i32 @signal(i32 %3, i32 %4)
%6 = call i32 (...) @closeFramebuffer()
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@SIG_IGN = global i32 0
define void @INThandler(i32 %0) {
%2 = load i32, i32* @SIG_IGN
%3 = tail call i32 @signal(i32 %0, i32 %2)
%4 = tail call i32 (...) @closeFramebuffer()
%5 = tail call i32 @exit(i32 0)
unreachable
}
int test_imm_A8uint16_mem(unsigned short *val) {
  return ((*val) & (-0xA8 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A8uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xffffff58,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A8uint16_mem>:
movzwl (%rdi),%eax
test   $0xff58,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A8uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -168
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_A8uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -168
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int circularModulo(int num, int mod) { return (num % mod + mod) % mod; }


x86 assembly (clang, -O0):
<circularModulo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
add    -0x8(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<circularModulo>:
mov    %edi,%eax
cltd
idiv   %esi
lea    (%rdx,%rsi,1),%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @circularModulo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = srem i32 %5, %6
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = srem i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @circularModulo(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = add nsw i32 %3, %1
%5 = srem i32 %4, %1
ret i32 %5
}
void ff_hevc_v_loop_filter_luma_10_sse2() {}


x86 assembly (clang, -O0):
<ff_hevc_v_loop_filter_luma_10_sse2>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ff_hevc_v_loop_filter_luma_10_sse2>:
ret

LLVM IR (-O0):
define void @ff_hevc_v_loop_filter_luma_10_sse2() {
ret void
}

LLVM IR (-O2):
define void @ff_hevc_v_loop_filter_luma_10_sse2() {
ret void
}
/* Variables and functions */
char *Op_eq(char *, char *);
char *Op_not(char *);
int /*<<< orphan*/ mu__free(char *, int, char *);
char *Op_ne(char *arg1, char *arg2) {
  char *tmp = Op_eq(arg1, arg2);
  char *result = Op_not(tmp);
  mu__free("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/kaiaie/bile/refs/heads/master/src/Ops.c",
           283, tmp);
  return result;
}


x86 assembly (clang, -O0):
<Op_ne>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <Op_eq@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <Op_not@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdx
lea    0xe97(%rip),%rdi
mov    $0x11b,%esi
call   1050 <mu__free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op_ne>:
push   %r14
push   %rbx
push   %rax
call   1040 <Op_eq@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <Op_not@plt>
mov    %rax,%r14
lea    0xeb2(%rip),%rdi
mov    $0x11b,%esi
mov    %rbx,%rdx
call   1050 <mu__free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [130 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kaiaie/bile/refs/heads/master/src/Ops.c\00"
define i8* @Op_ne(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i8* @Op_eq(i8* %7, i8* %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = call i8* @Op_not(i8* %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %5
%13 = call i32 @mu__free(i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str, i64 0, i64 0), i32 283, i8* %12)
%14 = load i8*, i8** %6
ret i8* %14
}

LLVM IR (-O2):
@.str = [130 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kaiaie/bile/refs/heads/master/src/Ops.c\00"
define i8* @Op_ne(i8* %0, i8* %1) {
%3 = tail call i8* @Op_eq(i8* %0, i8* %1)
%4 = tail call i8* @Op_not(i8* %3)
%5 = tail call i32 @mu__free(i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str, i64 0, i64 0), i32 283, i8* %3)
ret i8* %4
}
int mcp3301Convert(int val) {
  if (val > 4095) {
    val = ~val;
    val &= 0x0FFF;
    val = -val;
  }
  val += 4095;
  return val;
}


x86 assembly (clang, -O0):
<mcp3301Convert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xfff,-0x4(%rbp)
jle    1130 <mcp3301Convert+0x30>
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfff,%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xfff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcp3301Convert>:
mov    %edi,%eax
or     $0xfffff000,%eax
add    $0x1,%eax
cmp    $0x1000,%edi
cmovl  %edi,%eax
add    $0xfff,%eax
ret

LLVM IR (-O0):
define i32 @mcp3301Convert(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 4095
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = xor i32 %6, -1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = and i32 %8, 4095
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = sub nsw i32 0, %10
store i32 %11, i32* %2
br label %12
12: ; preds = %5, %1
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 4095
store i32 %14, i32* %2
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @mcp3301Convert(i32 %0) {
%2 = icmp sgt i32 %0, 4095
%3 = or i32 %0, -4096
%4 = add nsw i32 %3, 1
%5 = select i1 %2, i32 %4, i32 %0
%6 = add nsw i32 %5, 4095
ret i32 %6
}
int hcf(int u, int v) {
  int t, r;
  if (v > u) {
    t = u;
    u = v;
    v = t;
  }
  while ((r = u % v) != 0) {
    u = v;
    v = r;
  }
  return (v);
}


x86 assembly (clang, -O0):
<hcf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    1128 <hcf+0x28>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    112d <hcf+0x2d>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x10(%rbp)
cmp    $0x0,%edx
je     1151 <hcf+0x51>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    112d <hcf+0x2d>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hcf>:
cmp    %edi,%esi
mov    %esi,%edx
cmovg  %edi,%edx
cmovg  %esi,%edi
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
mov    %edx,%edi
cltd
idiv   %edi
test   %edx,%edx
jne    1110 <hcf+0x10>
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @hcf(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = icmp sgt i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* %3
store i32 %11, i32* %5
%12 = load i32, i32* %4
store i32 %12, i32* %3
%13 = load i32, i32* %5
store i32 %13, i32* %4
br label %14
14: ; preds = %10, %2
br label %15
15: ; preds = %20, %14
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = srem i32 %16, %17
store i32 %18, i32* %6
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i32, i32* %4
store i32 %21, i32* %3
%22 = load i32, i32* %6
store i32 %22, i32* %4
br label %15
23: ; preds = %15
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
define i32 @hcf(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
%4 = select i1 %3, i32 %0, i32 %1
%5 = select i1 %3, i32 %1, i32 %0
br label %6
6: ; preds = %6, %2
%7 = phi i32 [ %4, %2 ], [ %9, %6 ]
%8 = phi i32 [ %5, %2 ], [ %7, %6 ]
%9 = srem i32 %8, %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void rtp2435_set_height(uint8_t *header, uint8_t height) { header[7] = height; }


x86 assembly (clang, -O0):
<rtp2435_set_height>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtp2435_set_height>:
mov    %esi,0x1c(%rdi)
ret

LLVM IR (-O0):
define void @rtp2435_set_height(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 7
store i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @rtp2435_set_height(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 7
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M582_f(char *s) {
  debug("M582_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M582_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M582_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M582_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M582_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M582_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M582_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void set_le32(uint32_t *p, uint32_t v) {
  union {
    uint32_t i;
    uint8_t b[4];
  } u;
  u.b[0] = v & 0xff;
  u.b[1] = (v >> 8) & 0xff;
  u.b[2] = (v >> 16) & 0xff;
  u.b[3] = (v >> 24) & 0xff;
  *p = u.i;
}


x86 assembly (clang, -O0):
<set_le32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_le32>:
movzbl %sil,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
%union.anon = type { [4 x i32] }
define void @set_le32(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca %union.anon
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = and i32 %6, 255
%8 = bitcast %union.anon* %5 to [4 x i32]*
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %4
%11 = ashr i32 %10, 8
%12 = and i32 %11, 255
%13 = bitcast %union.anon* %5 to [4 x i32]*
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %13, i64 0, i64 1
store i32 %12, i32* %14
%15 = load i32, i32* %4
%16 = ashr i32 %15, 16
%17 = and i32 %16, 255
%18 = bitcast %union.anon* %5 to [4 x i32]*
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 0, i64 2
store i32 %17, i32* %19
%20 = load i32, i32* %4
%21 = ashr i32 %20, 24
%22 = and i32 %21, 255
%23 = bitcast %union.anon* %5 to [4 x i32]*
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %23, i64 0, i64 3
store i32 %22, i32* %24
%25 = bitcast %union.anon* %5 to i32*
%26 = load i32, i32* %25
%27 = load i32*, i32** %3
store i32 %26, i32* %27
ret void
}

LLVM IR (-O2):
define void @set_le32(i32* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 255
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
int get_random(int, int);
int partition(int *, int, int);
int /*<<< orphan*/ swap_int_arr(int *, int, int);
int randomized_partition(int *data_set, int f, int l) {
  int i = get_random(f, l);
  swap_int_arr(data_set, l, i);
  return partition(data_set, f, l);
}


x86 assembly (clang, -O0):
<randomized_partition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <get_random@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <swap_int_arr@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <partition@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomized_partition>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %esi,%edi
mov    %edx,%esi
call   1030 <get_random@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <swap_int_arr@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <partition@plt>

LLVM IR (-O0):
define i32 @randomized_partition(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @get_random(i32 %8, i32 %9)
store i32 %10, i32* %7
%11 = load i32*, i32** %4
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @swap_int_arr(i32* %11, i32 %12, i32 %13)
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call i32 @partition(i32* %15, i32 %16, i32 %17)
ret i32 %18
}

LLVM IR (-O2):
define i32 @randomized_partition(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @get_random(i32 %1, i32 %2)
%5 = tail call i32 @swap_int_arr(i32* %0, i32 %2, i32 %4)
%6 = tail call i32 @partition(i32* %0, i32 %1, i32 %2)
ret i32 %6
}
int __attribute__((weak)) dlclose(void *handler) { return -1; }


x86 assembly (clang, -O0):
<dlclose>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlclose>:
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define weak i32 @dlclose(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i32 -1
}

LLVM IR (-O2):
define weak i32 @dlclose(i8* %0) {
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ fpu_control_t;

/* Variables and functions */
int /*<<< orphan*/ _FPU_DOUBLE;
int /*<<< orphan*/ _FPU_EXTENDED;
int /*<<< orphan*/ _FPU_GETCW(int /*<<< orphan*/);
int /*<<< orphan*/ _FPU_SETCW(int /*<<< orphan*/);
void setDoublePrecision() {
  fpu_control_t cw;
  _FPU_GETCW(cw);
  cw &= ~_FPU_EXTENDED;
  cw |= _FPU_DOUBLE;
  _FPU_SETCW(cw);
}


x86 assembly (clang, -O0):
<setDoublePrecision>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
call   1030 <_FPU_GETCW@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    0x2eaf(%rip),%rax
mov    (%rax),%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <_FPU_SETCW@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setDoublePrecision>:
push   %rax
call   1030 <_FPU_GETCW@plt>
mov    0x2ecb(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <_FPU_SETCW@plt>

LLVM IR (-O0):
@_FPU_EXTENDED = global i32 0
@_FPU_DOUBLE = global i32 0
define void @setDoublePrecision() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @_FPU_GETCW(i32 %2)
%4 = load i32, i32* @_FPU_EXTENDED
%5 = xor i32 %4, -1
%6 = load i32, i32* %1
%7 = and i32 %6, %5
store i32 %7, i32* %1
%8 = load i32, i32* @_FPU_DOUBLE
%9 = load i32, i32* %1
%10 = or i32 %9, %8
store i32 %10, i32* %1
%11 = load i32, i32* %1
%12 = call i32 @_FPU_SETCW(i32 %11)
ret void
}

LLVM IR (-O2):
@_FPU_EXTENDED = global i32 0
@_FPU_DOUBLE = global i32 0
define void @setDoublePrecision() {
%1 = tail call i32 @_FPU_GETCW(i32 undef)
%2 = load i32, i32* @_FPU_DOUBLE
%3 = tail call i32 @_FPU_SETCW(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
void hello() {
  write(1, "Hello world!\n", 13);
  exit(0);
}


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xed0(%rip),%rsi
mov    $0xd,%edx
call   1030 <write@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<hello>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x1,%edi
mov    $0xd,%edx
call   1030 <write@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
define void @hello() {
%1 = call i32 @write(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello world!\0A\00"
define void @hello() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int optind;
bool xs_has_arg(int argc, char *argv[]) {
  return optind < argc && argv[optind][0] != '-' && argv[optind][0] != '!';
}


x86 assembly (clang, -O0):
<xs_has_arg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
cmp    -0x4(%rbp),%ecx
mov    %al,-0x11(%rbp)
jge    1163 <xs_has_arg+0x63>
mov    -0x10(%rbp),%rax
mov    0x2ebb(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0x11(%rbp)
je     1163 <xs_has_arg+0x63>
mov    -0x10(%rbp),%rax
mov    0x2e98(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x21,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xs_has_arg>:
mov    0x2ee1(%rip),%rax
movslq (%rax),%rcx
xor    %eax,%eax
cmp    %edi,%ecx
jge    1123 <xs_has_arg+0x23>
mov    (%rsi,%rcx,8),%rcx
mov    (%rcx),%cl
cmp    $0x2d,%cl
je     1123 <xs_has_arg+0x23>
xor    %eax,%eax
cmp    $0x21,%cl
setne  %al
ret

LLVM IR (-O0):
@optind = global i32 0
define i32 @xs_has_arg(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @optind
%6 = load i32, i32* %3
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %28
8: ; preds = %2
%9 = load i8**, i8*** %4
%10 = load i32, i32* @optind
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %9, i64 %11
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 45
br i1 %17, label %18, label %28
18: ; preds = %8
%19 = load i8**, i8*** %4
%20 = load i32, i32* @optind
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 33
br label %28
28: ; preds = %18, %8, %2
%29 = phi i1 [ false, %8 ], [ false, %2 ], [ %27, %18 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
@optind = global i32 0
define i32 @xs_has_arg(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @optind
%4 = icmp slt i32 %3, %0
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds i8*, i8** %1, i64 %6
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 45
br i1 %10, label %14, label %11
11: ; preds = %5
%12 = icmp ne i8 %9, 33
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %11, %5, %2
%15 = phi i32 [ 0, %5 ], [ 0, %2 ], [ %13, %11 ]
ret i32 %15
}
/* Variables and functions */
char *rindex(const char *p, int ch) {
  char *save;
  char c;
  c = ch;
  for (save = NULL;; ++p) {
    if (*p == c)
      save = (char *)p;
    if (*p == '\0')
      return (save);
  }
}


x86 assembly (clang, -O0):
<rindex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0x19(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
jne    1134 <rindex+0x34>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    114a <rindex+0x4a>
mov    -0x18(%rbp),%rax
pop    %rbp
ret
jmp    114f <rindex+0x4f>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1119 <rindex+0x19>

x86 assembly (clang, -O2):
<rindex>:
movsbl %sil,%ecx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movsbl (%rdi),%edx
cmp    %edx,%ecx
cmove  %rdi,%rax
add    $0x1,%rdi
test   %edx,%edx
jne    1110 <rindex+0x10>
ret

LLVM IR (-O0):
define i8* @rindex(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = trunc i32 %7 to i8
store i8 %8, i8* %6
store i8* null, i8** %5
br label %9
9: ; preds = %26, %2
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %12, %14
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = load i8*, i8** %3
store i8* %17, i8** %5
br label %18
18: ; preds = %16, %9
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = load i8*, i8** %5
ret i8* %24
25: ; preds = %18
br label %26
26: ; preds = %25
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
br label %9
}

LLVM IR (-O2):
define i8* @rindex(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
br label %5
5: ; preds = %5, %2
%6 = phi i8* [ null, %2 ], [ %11, %5 ]
%7 = phi i8* [ %0, %2 ], [ %13, %5 ]
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %4, %9
%11 = select i1 %10, i8* %7, i8* %6
%12 = icmp eq i8 %8, 0
%13 = getelementptr inbounds i8, i8* %7, i64 1
br i1 %12, label %14, label %5
14: ; preds = %5
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
main() {
  int i = 0;
  f(i);
  {
    int i = 0;
    f(i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <f@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <f@plt>
xor    %edi,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @f(i32 %3)
store i32 0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @f(i32 %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 0)
%2 = tail call i32 @f(i32 0)
ret i32 0
}
/* Variables and functions */
int F(int);
int A(int a, int b) { return F(a) / F(b); }


x86 assembly (clang, -O0):
<A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <F@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <F@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<A>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1030 <F@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <F@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @A(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @F(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @F(i32 %7)
%9 = sdiv i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @A(i32 %0, i32 %1) {
%3 = tail call i32 @F(i32 %0)
%4 = tail call i32 @F(i32 %1)
%5 = sdiv i32 %3, %4
ret i32 %5
}
char *gp_strdup(s)
char *s;
{
  char *d;
  d = gp_alloc(strlen(s) + 1, "gp_strdup");
  if (d)
    memcpy(d, s, strlen(s) + 1);
  return d;
}


x86 assembly (clang, -O0):
<gp_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1040 <gp_alloc@plt>
cltq
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1198 <gp_strdup+0x68>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gp_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x1(%rax),%rdi
lea    0xeb9(%rip),%rsi
xor    %eax,%eax
call   1040 <gp_alloc@plt>
movslq %eax,%rbx
test   %ebx,%ebx
je     116c <gp_strdup+0x3c>
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <memcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"gp_strdup\00"
define i8* @gp_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add i64 %5, 1
%7 = call i32 (i64, i8*, ...) bitcast (i32 (...)* @gp_alloc to i32 (i64, i8*, ...)*)(i64 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %18
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = load i8*, i8** %2
%16 = call i64 @strlen(i8* %15)
%17 = add i64 %16, 1
br label %18
18: ; preds = %12, %1
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
@.str = [10 x i8] c"gp_strdup\00"
define i8* @gp_strdup(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i32 (i64, i8*, ...) bitcast (i32 (...)* @gp_alloc to i32 (i64, i8*, ...)*)(i64 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i32 %4, 0
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%10 = add i64 %9, 1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %6, i8* align 1 %0, i64 %10, i1 false)
br label %11
11: ; preds = %8, %1
ret i8* %6
}
void __ret_sig() {}


x86 assembly (clang, -O0):
<__ret_sig>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ret_sig>:
ret

LLVM IR (-O0):
define void @__ret_sig() {
ret void
}

LLVM IR (-O2):
define void @__ret_sig() {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int x;
};
typedef TYPE_1__ XCreateWindowEvent;

/* Variables and functions */
void set_XCreateWindowEvent_x(void *_p, int _v) {
  ((XCreateWindowEvent *)_p)->x = (int)_v;
}


x86 assembly (clang, -O0):
<set_XCreateWindowEvent_x>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XCreateWindowEvent_x>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XCreateWindowEvent_x(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XCreateWindowEvent_x(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
__attribute__((always_)) void wait_clocks(unsigned int clocks) {
  clocks >>= 1;
  while (clocks--) {
    asm("" ::: "memory");
  }
}


x86 assembly (clang, -O0):
<wait_clocks>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1129 <wait_clocks+0x29>
jmp    1110 <wait_clocks+0x10>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_clocks>:
cmp    $0x2,%edi
jb     1115 <wait_clocks+0x15>
shr    %edi
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%edi
jne    1110 <wait_clocks+0x10>
ret

LLVM IR (-O0):
define void @wait_clocks(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
store i32 %4, i32* %2
br label %5
5: ; preds = %9, %1
%6 = load i32, i32* %2
%7 = add i32 %6, -1
store i32 %7, i32* %2
%8 = icmp ne i32 %6, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @wait_clocks(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = lshr i32 %0, 1
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %7, %5 ], [ %4, %3 ]
%7 = add nsw i32 %6, -1
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5, %1
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int equal_string(void *s1, void *s2) {
  char **string1 = (char **)s1;
  char **string2 = (char **)s2;
  return strcmp(*string1, *string2);
}


x86 assembly (clang, -O0):
<equal_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal_string>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @equal_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %12, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @equal_string(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
double __ocml_rsqrt_f64(double);
double rsqrt(double x) { return __ocml_rsqrt_f64(x); }


x86 assembly (clang, -O0):
<rsqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <__ocml_rsqrt_f64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsqrt>:
jmp    1030 <__ocml_rsqrt_f64@plt>

LLVM IR (-O0):
define double @rsqrt(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @__ocml_rsqrt_f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @rsqrt(double %0) {
%2 = tail call double @__ocml_rsqrt_f64(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ test_read_maps();
int main(int argc, const char *argv[]) {
  test_read_maps();
  return 0;
}


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    $0x0,%al
call   1030 <test_read_maps@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_read_maps@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 (...) @test_read_maps()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_read_maps()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ evloop_stop();
void sig_int_term_handler(int signal) { evloop_stop(); }


x86 assembly (clang, -O0):
<sig_int_term_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <evloop_stop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_int_term_handler>:
xor    %eax,%eax
jmp    1030 <evloop_stop@plt>

LLVM IR (-O0):
define void @sig_int_term_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @evloop_stop()
ret void
}

LLVM IR (-O2):
define void @sig_int_term_handler(i32 %0) {
%2 = tail call i32 (...) @evloop_stop()
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ux00ddr_getdramclass(size_t ahbregaddr) {
  return (((*(volatile uint32_t *)((0) + (ahbregaddr))) >> 8) & 0xF);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x0,%rax
mov    (%rax),%eax
sar    $0x8,%eax
and    $0xf,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    (%rdi),%eax
shr    $0x8,%eax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @ux00ddr_getdramclass(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 0, %3
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = ashr i32 %6, 8
%8 = and i32 %7, 15
ret i32 %8
}

LLVM IR (-O2):
define i32 @ux00ddr_getdramclass(i64 %0) {
%2 = inttoptr i64 %0 to i32*
%3 = load volatile i32, i32* %2
%4 = lshr i32 %3, 8
%5 = and i32 %4, 15
ret i32 %5
}
void pe_parser_close(struct pe_parser *p) {}


x86 assembly (clang, -O0):
<pe_parser_close>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pe_parser_close>:
ret

LLVM IR (-O0):
%struct.pe_parser = type opaque
define void @pe_parser_close(%struct.pe_parser* %0) {
%2 = alloca %struct.pe_parser*
store %struct.pe_parser* %0, %struct.pe_parser** %2
ret void
}

LLVM IR (-O2):
%struct.pe_parser = type opaque
define void @pe_parser_close(%struct.pe_parser* nocapture %0) {
ret void
}
int test_imm_CEint16_mem(short *val) {
  return ((*val) & (-0xCE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_CEint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffff32,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_CEint16_mem>:
movzwl (%rdi),%eax
test   $0xff32,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_CEint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -206
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_CEint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -206
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void areaOfRectangle(int length, int width, int *pArea) {
  *pArea = length * width;
}


x86 assembly (clang, -O0):
<areaOfRectangle>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<areaOfRectangle>:
imul   %esi,%edi
mov    %edi,(%rdx)
ret

LLVM IR (-O0):
define void @areaOfRectangle(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = mul nsw i32 %7, %8
%10 = load i32*, i32** %6
store i32 %9, i32* %10
ret void
}

LLVM IR (-O2):
define void @areaOfRectangle(i32 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = mul nsw i32 %1, %0
store i32 %4, i32* %2
ret void
}
/* Variables and functions */
float sqrtf(float);
float t1(float a, float b) { return a / sqrtf(b); }


x86 assembly (clang, -O0):
<t1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1>:
movaps %xmm0,%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jb     1124 <t1+0x14>
xorps  %xmm0,%xmm0
sqrtss %xmm1,%xmm0
jmp    113d <t1+0x2d>
push   %rax
movaps %xmm1,%xmm0
movss  %xmm2,0x4(%rsp)
call   1030 <sqrtf@plt>
movss  0x4(%rsp),%xmm2
add    $0x8,%rsp
divss  %xmm0,%xmm2
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @t1(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call float @sqrtf(float %6)
%8 = fdiv float %5, %7
ret float %8
}

LLVM IR (-O2):
define float @t1(float %0, float %1) {
%3 = tail call float @sqrtf(float %1)
%4 = fdiv float %0, %3
ret float %4
}