xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ getpid();
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ sleep(int);
void voyeur_request_debug(const char *reason) {
  perror(reason);
  char keep_looping = 1;
  while (keep_looping) {
    printf("ATTACH DEBUGGER TO %u\n", (unsigned)getpid());
    sleep(10);
  }
}


x86 assembly (clang, -O0):
<voyeur_request_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <perror@plt>
movb   $0x1,-0x9(%rbp)
cmpb   $0x0,-0x9(%rbp)
je     1187 <voyeur_request_debug+0x47>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1060 <sleep@plt>
jmp    1159 <voyeur_request_debug+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<voyeur_request_debug>:
push   %rbx
call   1050 <perror@plt>
lea    0xeb3(%rip),%rbx
nopl   (%rax)
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1060 <sleep@plt>
jmp    1150 <voyeur_request_debug+0x10>

LLVM IR (-O0):
@.str = [23 x i8] c"ATTACH DEBUGGER TO %u\0A\00"
define void @voyeur_request_debug(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @perror(i8* %4)
store i8 1, i8* %3
br label %6
6: ; preds = %9, %1
%7 = load i8, i8* %3
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = call i64 (...) @getpid()
%11 = trunc i64 %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @sleep(i32 10)
br label %6
14: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"ATTACH DEBUGGER TO %u\0A\00"
define void @voyeur_request_debug(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
br label %3
3: ; preds = %3, %1
%4 = tail call i64 (...) @getpid()
%5 = trunc i64 %4 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @sleep(i32 10)
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ param;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int const *, int);
int SetReuseAddress(int socket) {
  const int param = 1;
  return setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, &param, sizeof(param));
}


x86 assembly (clang, -O0):
<SetReuseAddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetReuseAddress>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @SetReuseAddress(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @SOL_SOCKET
%6 = load i32, i32* @SO_REUSEADDR
%7 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i32* %3, i32 4)
ret i32 %7
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @SetReuseAddress(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_REUSEADDR
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
ret i32 %6
}
int test_imm_08int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x08 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_08int64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0x8,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_08int64_midword_mem>:
testb  $0x8,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_08int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 8
%7 = icmp ne i64 %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_08int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 524288
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ ECHILD;
int /*<<< orphan*/ errno;
pid_t waitpid(pid_t pid, int *stat_loc, int options) {
  errno = ECHILD;
  return -1;
}


x86 assembly (clang, -O0):
<waitpid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ec3(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec2(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<waitpid>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ECHILD = global i32 0
@errno = global i32 0
define i32 @waitpid(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* @ECHILD
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ECHILD = global i32 0
@errno = global i32 0
define i32 @waitpid(i32 %0, i32* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @ECHILD
store i32 %4, i32* @errno
ret i32 -1
}
/* Variables and functions */
scalar_t__ prime(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned i = 0;
  unsigned j = 0;
  for (i; i < 1000; ++i) {
    if (prime(i))
      printf("%u\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jae    117e <main+0x5e>
mov    -0x8(%rbp),%edi
call   1040 <prime@plt>
cmp    $0x0,%rax
je     116b <main+0x4b>
mov    -0x8(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    1170 <main+0x50>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
jmp    113b <main+0x1b>
nop
add    $0x1,%ebx
cmp    $0x3e8,%ebx
je     1153 <main+0x33>
mov    %ebx,%edi
call   1040 <prime@plt>
test   %rax,%rax
je     1130 <main+0x10>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1130 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 0, %0 ], [ %8, %7 ]
%3 = tail call i64 @prime(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
7: ; preds = %1, %5
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 1000
br i1 %9, label %10, label %1
10: ; preds = %7
ret i32 0
}
/* Variables and functions */
scalar_t__ ReadControlFile(char *);
int /*<<< orphan*/ printf(char *);
int mainProgram(char *controlFileName) {
  int ret = 0;
  ret += ReadControlFile(controlFileName);
  if (ret > 0) {
    printf("Control file could not be read!\n");
    return ret;
  }
  return ret;
}


x86 assembly (clang, -O0):
<mainProgram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ReadControlFile@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    116a <mainProgram+0x4a>
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <mainProgram+0x50>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mainProgram>:
push   %rbx
call   1030 <ReadControlFile@plt>
mov    %rax,%rbx
test   %ebx,%ebx
jle    1139 <mainProgram+0x19>
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Control file could not be read!\0A\00"
define i32 @mainProgram(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%5 = load i8*, i8** %3
%6 = call i64 @ReadControlFile(i8* %5)
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = add nsw i64 %8, %6
%10 = trunc i64 %9 to i32
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* %4
store i32 %15, i32* %2
br label %18
16: ; preds = %1
%17 = load i32, i32* %4
store i32 %17, i32* %2
br label %18
18: ; preds = %16, %13
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@str = [32 x i8] c"Control file could not be read!\00"
define i32 @mainProgram(i8* %0) {
%2 = tail call i64 @ReadControlFile(i8* %0)
%3 = trunc i64 %2 to i32
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %1, %5
ret i32 %3
}
int test_imm_AFuint16_reg(unsigned short val) {
  return ((val) & (0xAF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_AFuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xaf,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_AFuint16_reg>:
test   $0xaf,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_AFuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 175
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ errx(char *);
void usage(void) {
  errx("./prog -b bindaddr -B bindport -c connaddr -C connport");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <errx@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [55 x i8] c"./prog -b bindaddr -B bindport -c connaddr -C connport\00"
define void @usage() {
%1 = call i32 @errx(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"./prog -b bindaddr -B bindport -c connaddr -C connport\00"
define void @usage() {
%1 = tail call i32 @errx(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
ret void
}
const char *TA_GetVersionMinor(void) { return "6"; }


x86 assembly (clang, -O0):
<TA_GetVersionMinor>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TA_GetVersionMinor>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"6\00"
define i8* @TA_GetVersionMinor() {
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [2 x i8] c"6\00"
define i8* @TA_GetVersionMinor() {
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct sbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sbuf_init_with_size(struct sbuf *, int);
void sbuf_init(struct sbuf *s) { sbuf_init_with_size(s, 1); }


x86 assembly (clang, -O0):
<sbuf_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <sbuf_init_with_size@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbuf_init>:
mov    $0x1,%esi
jmp    1030 <sbuf_init_with_size@plt>

LLVM IR (-O0):
%struct.sbuf = type { i32 }
define void @sbuf_init(%struct.sbuf* %0) {
%2 = alloca %struct.sbuf*
store %struct.sbuf* %0, %struct.sbuf** %2
%3 = load %struct.sbuf*, %struct.sbuf** %2
%4 = call i32 @sbuf_init_with_size(%struct.sbuf* %3, i32 1)
ret void
}

LLVM IR (-O2):
%struct.sbuf = type { i32 }
define void @sbuf_init(%struct.sbuf* %0) {
%2 = tail call i32 @sbuf_init_with_size(%struct.sbuf* %0, i32 1)
ret void
}
/* Variables and functions */
int bitCount(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int, int);
int main(void) {
  unsigned int i = 32767;
  int numbits = bitCount(i);
  printf("num of set bits in %u is %d\n", i, numbits);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7fff,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <bitCount@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7fff,%edi
call   1040 <bitCount@plt>
lea    0xece(%rip),%rdi
mov    $0x7fff,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"num of set bits in %u is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 32767, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @bitCount(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"num of set bits in %u is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @bitCount(i32 32767)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 32767, i32 %1)
ret i32 0
}
unsigned int msm_spm_get_vdd(void) { return 0; }


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

x86 assembly (clang, -O2):
<msm_spm_get_vdd>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @msm_spm_get_vdd() {
ret i32 0
}

LLVM IR (-O2):
define i32 @msm_spm_get_vdd() {
ret i32 0
}
int compar(const void *a, const void *b) {
  const unsigned char *A = *(void **)a;
  const unsigned char *B = *(void **)b;
  int l;
  while (l = (*A - *B)) {
    if (!*A)
      return 0;
    ++A;
    ++B;
  }
  return l;
}


x86 assembly (clang, -O0):
<compar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
je     1174 <compar+0x74>
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1157 <compar+0x57>
movl   $0x0,-0x4(%rbp)
jmp    117a <compar+0x7a>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1122 <compar+0x22>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compar>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @compar(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
%11 = load i8*, i8** %10
store i8* %11, i8** %6
%12 = load i8*, i8** %5
%13 = bitcast i8* %12 to i8**
%14 = load i8*, i8** %13
store i8* %14, i8** %7
br label %15
15: ; preds = %29, %2
%16 = load i8*, i8** %6
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8*, i8** %7
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = sub nsw i32 %18, %21
store i32 %22, i32* %8
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %15
%25 = load i8*, i8** %6
%26 = load i8, i8* %25
%27 = icmp ne i8 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %24
store i32 0, i32* %3
br label %36
29: ; preds = %24
%30 = load i8*, i8** %6
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %6
%32 = load i8*, i8** %7
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %7
br label %15
34: ; preds = %15
%35 = load i32, i32* %8
store i32 %35, i32* %3
br label %36
36: ; preds = %34, %28
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @compar(i8* nocapture %0, i8* nocapture %1) {
ret i32 0
}
unsigned long insert_bdp(unsigned long insn, long value, const char **errmsg) {
  if ((value & 0x8000) == 0)
    insn |= 1 << 21;
  return insn | (value & 0xfffc);
}


x86 assembly (clang, -O0):
<insert_bdp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x8000,%rax
cmp    $0x0,%rax
jne    1132 <insert_bdp+0x32>
mov    -0x8(%rbp),%rax
or     $0x200000,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0xfffc,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_bdp>:
mov    %esi,%eax
shl    $0x6,%eax
not    %eax
and    $0x200000,%eax
and    $0xfffc,%esi
or     %rdi,%rsi
or     %rsi,%rax
ret

LLVM IR (-O0):
define i64 @insert_bdp(i64 %0, i64 %1, i8** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8** %2, i8*** %6
%7 = load i64, i64* %5
%8 = and i64 %7, 32768
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i64, i64* %4
%12 = or i64 %11, 2097152
store i64 %12, i64* %4
br label %13
13: ; preds = %10, %3
%14 = load i64, i64* %4
%15 = load i64, i64* %5
%16 = and i64 %15, 65532
%17 = or i64 %14, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @insert_bdp(i64 %0, i64 %1, i8** nocapture readnone %2) {
%4 = shl i64 %1, 6
%5 = and i64 %4, 2097152
%6 = xor i64 %5, 2097152
%7 = and i64 %1, 65532
%8 = or i64 %7, %0
%9 = or i64 %8, %6
ret i64 %9
}
volatile char *build_popa(volatile char *tgt_addr) {
  (*(char *)tgt_addr) = 0x61;
  tgt_addr += 0x1;
  return (tgt_addr);
}


x86 assembly (clang, -O0):
<build_popa>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x61,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_popa>:
movb   $0x61,(%rdi)
lea    0x1(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @build_popa(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
store i8 97, i8* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %5, i8** %2
%6 = load i8*, i8** %2
ret i8* %6
}

LLVM IR (-O2):
define i8* @build_popa(i8* writeonly %0) {
store i8 97, i8* %0
%2 = getelementptr inbounds i8, i8* %0, i64 1
ret i8* %2
}
/* Variables and functions */
int fork();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("Guten Tag %d\n", fork());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <fork@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <fork@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Guten Tag %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @fork()
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Guten Tag %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @fork()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void RTManifestEqualsEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTManifestEqualsEx() {
ret void
}
/* Type definitions */
struct stat {
  int st_mode;
};

/* Variables and functions */
int S_ISUID;
scalar_t__ stat(char *, struct stat *);
int unary_u(char *s) {
  struct stat buf;
  if (stat(s, &buf))
    return 0;
  return S_ISUID & buf.st_mode;
}


x86 assembly (clang, -O0):
<unary_u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     113f <unary_u+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    114e <unary_u+0x3e>
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unary_u>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    0x2ec8(%rip),%rcx
mov    (%rsp),%edx
and    (%rcx),%edx
xor    %ecx,%ecx
test   %rax,%rax
cmove  %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_ISUID = global i32 0
define i32 @unary_u(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %14
9: ; preds = %1
%10 = load i32, i32* @S_ISUID
%11 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%12 = load i32, i32* %11
%13 = and i32 %10, %12
store i32 %13, i32* %2
br label %14
14: ; preds = %9, %8
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_ISUID = global i32 0
define i32 @unary_u(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = load i32, i32* @S_ISUID
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = and i32 %8, %6
%10 = select i1 %5, i32 %9, i32 0
ret i32 %10
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ type;
};
typedef TYPE_1__ XSelectionEvent;

/* Variables and functions */
int get_XSelectionEvent_type(void *_p) {
  return (int)((XSelectionEvent *)_p)->type;
}


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

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

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

LLVM IR (-O2):
define i32 @get_XSelectionEvent_type(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
float Maxf(float, int /*<<< orphan*/);
int /*<<< orphan*/ Minf(float, float);
float Clampf(float v, float min, float max) { return Maxf(min, Minf(v, max)); }


x86 assembly (clang, -O0):
<Clampf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <Minf@plt>
movss  -0x10(%rbp),%xmm0
mov    %eax,%edi
call   1040 <Maxf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Clampf>:
push   %rax
movss  %xmm1,0x4(%rsp)
movaps %xmm2,%xmm1
call   1030 <Minf@plt>
movss  0x4(%rsp),%xmm0
mov    %eax,%edi
pop    %rax
jmp    1040 <Maxf@plt>

LLVM IR (-O0):
define float @Clampf(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %5
%8 = load float, float* %4
%9 = load float, float* %6
%10 = call i32 @Minf(float %8, float %9)
%11 = call float @Maxf(float %7, i32 %10)
ret float %11
}

LLVM IR (-O2):
define float @Clampf(float %0, float %1, float %2) {
%4 = tail call i32 @Minf(float %0, float %2)
%5 = tail call float @Maxf(float %1, i32 %4)
ret float %5
}
char *sub_signed(char *base, signed long offset) { return base - offset; }


x86 assembly (clang, -O0):
<sub_signed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_signed>:
mov    %rdi,%rax
sub    %rsi,%rax
ret

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

LLVM IR (-O2):
define i8* @sub_signed(i8* readnone %0, i64 %1) {
%3 = sub i64 0, %1
%4 = getelementptr inbounds i8, i8* %0, i64 %3
ret i8* %4
}
unsigned long comp(unsigned long a, unsigned long b, unsigned long mask) {
  return ((a ^ b) & mask) ^ b;
}


x86 assembly (clang, -O0):
<comp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    -0x10(%rbp),%rax
and    -0x18(%rbp),%rax
xor    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<comp>:
mov    %rdi,%rax
xor    %rsi,%rax
and    %rdx,%rax
xor    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @comp(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = xor i64 %7, %8
%10 = load i64, i64* %6
%11 = and i64 %9, %10
%12 = load i64, i64* %5
%13 = xor i64 %11, %12
ret i64 %13
}

LLVM IR (-O2):
define i64 @comp(i64 %0, i64 %1, i64 %2) {
%4 = xor i64 %1, %0
%5 = and i64 %4, %2
%6 = xor i64 %5, %1
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void default_print_string(const char *str) { printf("%s", str); }


x86 assembly (clang, -O0):
<default_print_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_print_string>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @default_print_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @default_print_string(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
char *strchr(char *, char);
int strlen(char *);
int find_domain_path_len(char url[]) {
  char *cpnt;
  if ((cpnt = strchr(url + 7, '/')) == NULL) {
    return 0;
  } else {
    return strlen(cpnt);
  }
}


x86 assembly (clang, -O0):
<find_domain_path_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x7,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1158 <find_domain_path_len+0x38>
movl   $0x0,-0x4(%rbp)
jmp    1164 <find_domain_path_len+0x44>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_domain_path_len>:
push   %rax
add    $0x7,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     113d <find_domain_path_len+0x1d>
mov    %rax,%rdi
pop    %rax
jmp    1030 <strlen@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @find_domain_path_len(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 7
%7 = call i8* @strchr(i8* %6, i8 signext 47)
store i8* %7, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %13
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @find_domain_path_len(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 7
%3 = tail call i8* @strchr(i8* %2, i8 signext 47)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @strlen(i8* %3)
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ %6, %5 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
unsigned char i2c_master_start(unsigned char);
unsigned char i2c_start_read(unsigned char addr) {
  return i2c_master_start((addr << 1) | 1);
}


x86 assembly (clang, -O0):
<i2c_start_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x1,%eax
or     $0x1,%eax
movzbl %al,%edi
call   1030 <i2c_master_start@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_start_read>:
add    %dil,%dil
or     $0x1,%dil
movzbl %dil,%edi
jmp    1030 <i2c_master_start@plt>

LLVM IR (-O0):
define zeroext i8 @i2c_start_read(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = shl i32 %4, 1
%6 = or i32 %5, 1
%7 = trunc i32 %6 to i8
%8 = call zeroext i8 @i2c_master_start(i8 zeroext %7)
ret i8 %8
}

LLVM IR (-O2):
define zeroext i8 @i2c_start_read(i8 zeroext %0) {
%2 = shl i8 %0, 1
%3 = or i8 %2, 1
%4 = tail call zeroext i8 @i2c_master_start(i8 zeroext %3)
ret i8 %4
}
unsigned long long nextPow2_64(unsigned long long x) {
  x--;
  x |= x >> 1;
  x |= x >> 2;
  x |= x >> 4;
  x |= x >> 8;
  x |= x >> 16;
  x |= x >> 32;
  x++;
  return x;
}


x86 assembly (clang, -O0):
<nextPow2_64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x2,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x4,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x20,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextPow2_64>:
lea    -0x1(%rdi),%rax
mov    %rax,%rcx
shr    %rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x2,%rax
or     %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x8,%rax
or     %rcx,%rax
mov    %rax,%rcx
shr    $0x10,%rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x20,%rax
or     %rcx,%rax
add    $0x1,%rax
ret

LLVM IR (-O0):
define i64 @nextPow2_64(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, -1
store i64 %4, i64* %2
%5 = load i64, i64* %2
%6 = lshr i64 %5, 1
%7 = load i64, i64* %2
%8 = or i64 %7, %6
store i64 %8, i64* %2
%9 = load i64, i64* %2
%10 = lshr i64 %9, 2
%11 = load i64, i64* %2
%12 = or i64 %11, %10
store i64 %12, i64* %2
%13 = load i64, i64* %2
%14 = lshr i64 %13, 4
%15 = load i64, i64* %2
%16 = or i64 %15, %14
store i64 %16, i64* %2
%17 = load i64, i64* %2
%18 = lshr i64 %17, 8
%19 = load i64, i64* %2
%20 = or i64 %19, %18
store i64 %20, i64* %2
%21 = load i64, i64* %2
%22 = lshr i64 %21, 16
%23 = load i64, i64* %2
%24 = or i64 %23, %22
store i64 %24, i64* %2
%25 = load i64, i64* %2
%26 = lshr i64 %25, 32
%27 = load i64, i64* %2
%28 = or i64 %27, %26
store i64 %28, i64* %2
%29 = load i64, i64* %2
%30 = add i64 %29, 1
store i64 %30, i64* %2
%31 = load i64, i64* %2
ret i64 %31
}

LLVM IR (-O2):
define i64 @nextPow2_64(i64 %0) {
%2 = add i64 %0, -1
%3 = lshr i64 %2, 1
%4 = or i64 %3, %2
%5 = lshr i64 %4, 2
%6 = or i64 %5, %4
%7 = lshr i64 %6, 4
%8 = or i64 %7, %6
%9 = lshr i64 %8, 8
%10 = or i64 %9, %8
%11 = lshr i64 %10, 16
%12 = or i64 %11, %10
%13 = lshr i64 %12, 32
%14 = or i64 %13, %12
%15 = add i64 %14, 1
ret i64 %15
}
/* Type definitions */
struct ts_value {
  int dummy;
};

/* Variables and functions */
int ts_set_valuef_arr(struct ts_value *, int, float *);
int ts_set_valuef(struct ts_value *tsv, float fnum) {
  return ts_set_valuef_arr(tsv, 1, &fnum);
}


x86 assembly (clang, -O0):
<ts_set_valuef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
lea    -0xc(%rbp),%rdx
call   1030 <ts_set_valuef_arr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_set_valuef>:
push   %rax
movss  %xmm0,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0x1,%esi
call   1030 <ts_set_valuef_arr@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.ts_value = type { i32 }
define i32 @ts_set_valuef(%struct.ts_value* %0, float %1) {
%3 = alloca %struct.ts_value*
%4 = alloca float
store %struct.ts_value* %0, %struct.ts_value** %3
store float %1, float* %4
%5 = load %struct.ts_value*, %struct.ts_value** %3
%6 = call i32 @ts_set_valuef_arr(%struct.ts_value* %5, i32 1, float* %4)
ret i32 %6
}

LLVM IR (-O2):
%struct.ts_value = type { i32 }
define i32 @ts_set_valuef(%struct.ts_value* %0, float %1) {
%3 = alloca float
store float %1, float* %3
%4 = call i32 @ts_set_valuef_arr(%struct.ts_value* %0, i32 1, float* %3)
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void dhara_w32(uint8_t *data, uint32_t v) {
  data[0] = v;
  data[1] = v >> 8;
  data[2] = v >> 16;
  data[3] = v >> 24;
}


x86 assembly (clang, -O0):
<dhara_w32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dhara_w32>:
mov    %esi,(%rdi)
mov    %esi,%eax
sar    $0x8,%eax
mov    %eax,0x4(%rdi)
mov    %esi,%eax
sar    $0x10,%eax
mov    %eax,0x8(%rdi)
sar    $0x18,%esi
mov    %esi,0xc(%rdi)
ret

LLVM IR (-O0):
define void @dhara_w32(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 0
store i32 %5, i32* %7
%8 = load i32, i32* %4
%9 = ashr i32 %8, 8
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 %9, i32* %11
%12 = load i32, i32* %4
%13 = ashr i32 %12, 16
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 2
store i32 %13, i32* %15
%16 = load i32, i32* %4
%17 = ashr i32 %16, 24
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 3
store i32 %17, i32* %19
ret void
}

LLVM IR (-O2):
define void @dhara_w32(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
%3 = ashr i32 %1, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %3, i32* %4
%5 = ashr i32 %1, 16
%6 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %5, i32* %6
%7 = ashr i32 %1, 24
%8 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %7, i32* %8
ret void
}
int func(struct root_struct *root) { return 0; }


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

x86 assembly (clang, -O2):
<func>:
xor    %eax,%eax
ret

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

LLVM IR (-O2):
%struct.root_struct = type opaque
define i32 @func(%struct.root_struct* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int errno;
int syscall(int, unsigned int, int /*<<< orphan*/, int /*<<< orphan*/,
            int /*<<< orphan*/, int /*<<< orphan*/);
unsigned alarm(unsigned s) {
  int ret = syscall(55, s, 0, 0, 0, 0);
  if (ret < 0) {
    errno = -ret;
    return -1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<alarm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x37,%edi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1030 <syscall@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    115b <alarm+0x4b>
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
mov    0x2e93(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1161 <alarm+0x51>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alarm>:
push   %rax
mov    %edi,%esi
mov    $0x37,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <syscall@plt>
test   %eax,%eax
js     112d <alarm+0x1d>
pop    %rcx
ret
neg    %eax
mov    0x2eaa(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @alarm(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @syscall(i32 55, i32 %5, i32 0, i32 0, i32 0, i32 0)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %4
%11 = sub nsw i32 0, %10
store i32 %11, i32* @errno
store i32 -1, i32* %2
br label %14
12: ; preds = %1
%13 = load i32, i32* %4
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @alarm(i32 %0) {
%2 = tail call i32 @syscall(i32 55, i32 %0, i32 0, i32 0, i32 0, i32 0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = sub nsw i32 0, %2
store i32 %5, i32* @errno
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ %2, %1 ]
ret i32 %7
}
unsigned long sub1(unsigned int i) { return i >> 1; }


x86 assembly (clang, -O0):
<sub1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub1>:
mov    %edi,%eax
shr    %eax
ret

LLVM IR (-O0):
define i64 @sub1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
%5 = zext i32 %4 to i64
ret i64 %5
}

LLVM IR (-O2):
define i64 @sub1(i32 %0) {
%2 = lshr i32 %0, 1
%3 = zext i32 %2 to i64
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ fmax(float, float);
float fmin(int /*<<< orphan*/, float);
float fclamp(float _a, float _min, float _max) {
  return fmin(fmax(_a, _min), _max);
}


x86 assembly (clang, -O0):
<fclamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <fmax@plt>
mov    %eax,%edi
movss  -0xc(%rbp),%xmm0
call   1030 <fmin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fclamp>:
push   %rax
movss  %xmm2,0x4(%rsp)
call   1040 <fmax@plt>
mov    %eax,%edi
movss  0x4(%rsp),%xmm0
pop    %rax
jmp    1030 <fmin@plt>

LLVM IR (-O0):
define float @fclamp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = call i32 @fmax(float %7, float %8)
%10 = load float, float* %6
%11 = call float @fmin(i32 %9, float %10)
ret float %11
}

LLVM IR (-O2):
define float @fclamp(float %0, float %1, float %2) {
%4 = tail call i32 @fmax(float %0, float %1)
%5 = tail call float @fmin(i32 %4, float %2)
ret float %5
}
char *getWord(int index, char words[2400][5]) {
  int i;
  char singleWord[5 + 1] = {0};
  for (i = 0; i < 5; i++)
    singleWord[i] = words[index][i];
  singleWord[5 + 1] = '\0';
  return singleWord;
}


x86 assembly (clang, -O0):
<getWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1a(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1030 <memset@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    116c <getWord+0x5c>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
imul   $0x5,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x1a(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <getWord+0x26>
movb   $0x0,-0x14(%rbp)
lea    -0x1a(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getWord>:
lea    -0x6(%rsp),%rax
ret

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

LLVM IR (-O2):
define noalias i8* @getWord(i32 %0, [5 x i8]* nocapture %1) {
%3 = alloca [6 x i8]
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
ret i8* %4
}
/* Variables and functions */
char *getenv(char const *);
const char *getEnvironment(const char *var) {
  const char *ret = NULL;
  if (var) {
    ret = getenv(var);
    if (!ret || *ret == '\0')
      return NULL;
  }
  return ret;
}


x86 assembly (clang, -O0):
<getEnvironment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1169 <getEnvironment+0x59>
mov    -0x10(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1157 <getEnvironment+0x47>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1164 <getEnvironment+0x54>
movq   $0x0,-0x8(%rbp)
jmp    1171 <getEnvironment+0x61>
jmp    1169 <getEnvironment+0x59>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getEnvironment>:
push   %rax
test   %rdi,%rdi
je     1127 <getEnvironment+0x17>
call   1030 <getenv@plt>
test   %rax,%rax
je     1127 <getEnvironment+0x17>
cmpb   $0x0,(%rax)
je     1127 <getEnvironment+0x17>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @getEnvironment(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* null, i8** %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %19
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i8* @getenv(i8* %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12, %7
store i8* null, i8** %2
br label %21
18: ; preds = %12
br label %19
19: ; preds = %18, %1
%20 = load i8*, i8** %4
store i8* %20, i8** %2
br label %21
21: ; preds = %19, %17
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
define i8* @getEnvironment(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i8* @getenv(i8* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = load i8, i8* %4
%8 = icmp eq i8 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6, %1
%10 = phi i8* [ %4, %6 ], [ null, %1 ]
br label %11
11: ; preds = %3, %6, %9
%12 = phi i8* [ %10, %9 ], [ null, %6 ], [ null, %3 ]
ret i8* %12
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t rtp3640_get_aac_hbr_au_size(const uint8_t *header) {
  return (header[0] << 5) | (header[1] >> 3);
}


x86 assembly (clang, -O0):
<rtp3640_get_aac_hbr_au_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x5,%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
sar    $0x3,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtp3640_get_aac_hbr_au_size>:
mov    (%rdi),%ecx
mov    0x4(%rdi),%eax
shl    $0x5,%ecx
sar    $0x3,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @rtp3640_get_aac_hbr_au_size(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 5
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = ashr i32 %9, 3
%11 = or i32 %6, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @rtp3640_get_aac_hbr_au_size(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 5
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = ashr i32 %5, 3
%7 = or i32 %6, %3
ret i32 %7
}
int c053(void) { return 0; }


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

x86 assembly (clang, -O2):
<c053>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @c053() {
ret i32 0
}

LLVM IR (-O2):
define i32 @c053() {
ret i32 0
}