xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void print_help(char **argv) {
  fprintf(stderr,
          "Usage: %s [options]\n"
          "Options:\n"
          "  -c\t\tPrint keyboard controls\n"
          "  -h\t\tPrint help and exit\n",
          argv[0]);
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    (%rdi),%rdx
lea    0xedd(%rip),%rsi
mov    %eax,%edi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [86 x i8] c"Usage: %s [options]\0AOptions:\0A -c\09\09Print keyboard controls\0A -h\09\09Print help and exit\0A\00"
define void @print_help(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @stderr
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [86 x i8] c"Usage: %s [options]\0AOptions:\0A -c\09\09Print keyboard controls\0A -h\09\09Print help and exit\0A\00"
define void @print_help(i8** nocapture %0) {
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %0
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *makestring(char *buf) {
  char *cp;
  buf[strlen(buf)] = '\0';
  cp = malloc(strlen(buf) + 1);
  strcpy(cp, buf);
  return cp;
}


x86 assembly (clang, -O0):
<makestring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makestring>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
cltq
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @makestring(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
store i8 0, i8* %8
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %10, 1
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @makestring(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 0, i8* %4
%5 = tail call i32 @strlen(i8* %0)
%6 = add nsw i32 %5, 1
%7 = tail call i8* @malloc(i32 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
ret i8* %7
}
/* Variables and functions */
int strcmp(char *, char *);
int cmpDict(const void *pa, const void *pb) {
  char *p1 = (char *)pa;
  char *p2 = (char *)pb;
  return strcmp(p1, p2);
}


x86 assembly (clang, -O0):
<cmpDict>:
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),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpDict>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @cmpDict(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
store i8* %7, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @strcmp(i8* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmpDict(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int htons(unsigned int);
int ntohs(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  unsigned int s;
  s = 389;
  printf("int:   %u\n", s);
  printf("htons: %u\n", htons(s));
  printf("ntohs: %u\n", ntohs(htons(s)));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x185,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,%edi
call   1050 <ntohs@plt>
mov    %eax,%esi
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
mov    $0x185,%esi
call   1040 <printf@plt>
mov    $0x185,%edi
call   1030 <htons@plt>
lea    0xeb8(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x185,%edi
call   1030 <htons@plt>
mov    %eax,%edi
call   1050 <ntohs@plt>
lea    0xea4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"int: %u\0A\00"
@.str.1 = [11 x i8] c"htons: %u\0A\00"
@.str.2 = [11 x i8] c"ntohs: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 389, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @htons(i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %2
%9 = call i32 @htons(i32 %8)
%10 = call i32 @ntohs(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"int: %u\0A\00"
@.str.1 = [11 x i8] c"htons: %u\0A\00"
@.str.2 = [11 x i8] c"ntohs: %u\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 389)
%2 = tail call i32 @htons(i32 389)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = tail call i32 @htons(i32 389)
%5 = tail call i32 @ntohs(i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int strcmp(char *, char *);
int compareStrings(const void *pStr1, const void *pStr2) {
  return strcmp(*(char **)pStr1, *(char **)pStr2);
}


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

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

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

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


x86 assembly (clang, -O0):
<cdfExponential>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xead(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdfExponential>:
push   %rax
xorpd  0xee7(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
movsd  0xee2(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @cdfExponential(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fneg double %5
%7 = load double, double* %3
%8 = fdiv double %6, %7
%9 = call double @exp(double %8)
%10 = fsub double 1.000000e+00, %9
ret double %10
}

LLVM IR (-O2):
define double @cdfExponential(double %0, double %1) {
%3 = fneg double %1
%4 = fdiv double %3, %0
%5 = tail call double @exp(double %4)
%6 = fsub double 1.000000e+00, %5
ret double %6
}
/* Variables and functions */
int __simc(int, int, int, int);
int simc_open(const char *file, int flags, int mode) {
  return __simc(5, (int)file, flags, mode);
}


x86 assembly (clang, -O0):
<simc_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0x5,%edi
call   1030 <__simc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simc_open>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0x5,%edi
jmp    1030 <__simc@plt>

LLVM IR (-O0):
define i32 @simc_open(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i32
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @__simc(i32 5, i32 %8, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @simc_open(i8* %0, i32 %1, i32 %2) {
%4 = ptrtoint i8* %0 to i64
%5 = trunc i64 %4 to i32
%6 = tail call i32 @__simc(i32 5, i32 %5, i32 %1, i32 %2)
ret i32 %6
}
double test_cabs(_Complex double x) { return __builtin_cabs(x); }


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

x86 assembly (clang, -O2):
<test_cabs>:
jmp    1030 <cabs@plt>

LLVM IR (-O0):
define double @test_cabs(double %0, double %1) {
%3 = alloca { double, double }
%4 = alloca { double, double }
%5 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
store double %0, double* %5
%6 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
store double %1, double* %6
%7 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
%10 = load double, double* %9
%11 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 0
%12 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 1
store double %8, double* %11
store double %10, double* %12
%13 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 0
%14 = load double, double* %13
%15 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 1
%16 = load double, double* %15
%17 = call double @cabs(double %14, double %16)
ret double %17
}

LLVM IR (-O2):
define double @test_cabs(double %0, double %1) {
%3 = tail call double @cabs(double %0, double %1)
ret double %3
}
void udelay(unsigned long n) {
  if (!n)
    return;
  asm("1: dec %%eax; jne 1b;" : : "a"(n * 1000));
}


x86 assembly (clang, -O0):
<udelay>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1118 <udelay+0x18>
jmp    1128 <udelay+0x28>
imul   $0x3e8,-0x8(%rbp),%rax
dec    %eax
jne    1120 <udelay+0x20>
pop    %rbp
ret

x86 assembly (clang, -O2):
<udelay>:
test   %rdi,%rdi
je     1110 <udelay+0x10>
imul   $0x3e8,%rdi,%rax
dec    %eax
jne    110c <udelay+0xc>
ret

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

LLVM IR (-O2):
define void @udelay(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = mul i64 %0, 1000
tail call void asm sideeffect "1: dec %eax; jne 1b;", "{ax},~{dirflag},~{fpsr},~{flags}"(i64 %4)
br label %5
5: ; preds = %1, %3
ret void
}
void rop3_187_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~S;
  stk1 = *D | stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_187_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_187_1_1>:
or     %esi,%edx
mov    %esi,%eax
not    %al
mov    (%rdi),%cl
or     %cl,%al
not    %dl
and    %al,%dl
or     %cl,%dl
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_187_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %7
%20 = load i8, i8* %7
%21 = zext i8 %20 to i32
%22 = load i8, i8* %5
%23 = zext i8 %22 to i32
%24 = xor i32 %23, -1
%25 = and i32 %21, %24
%26 = load i8, i8* %6
%27 = zext i8 %26 to i32
%28 = xor i32 %27, -1
%29 = and i32 %25, %28
%30 = load i8*, i8** %4
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = load i8, i8* %5
%34 = zext i8 %33 to i32
%35 = and i32 %32, %34
%36 = or i32 %29, %35
%37 = load i8*, i8** %4
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = load i8, i8* %6
%41 = zext i8 %40 to i32
%42 = and i32 %39, %41
%43 = or i32 %36, %42
%44 = trunc i32 %43 to i8
%45 = load i8*, i8** %4
store i8 %44, i8* %45
ret void
}

LLVM IR (-O2):
define void @rop3_187_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %1, -1
%5 = load i8, i8* %0
%6 = or i8 %5, %4
%7 = or i8 %2, %1
%8 = xor i8 %7, -1
%9 = and i8 %6, %8
%10 = or i8 %5, %9
store i8 %10, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
size_t fread(void *, size_t, int, int /*<<< orphan*/ *);
size_t c_get_urandom_bytes(void *out, size_t c, FILE *fh) {
  if (NULL == fh) {
    return 0;
  }
  size_t r = fread(out, c, 1, fh);
  fclose(fh);
  return r;
}


x86 assembly (clang, -O0):
<c_get_urandom_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    114d <c_get_urandom_bytes+0x2d>
movq   $0x0,-0x8(%rbp)
jmp    1178 <c_get_urandom_bytes+0x58>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fread@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_get_urandom_bytes>:
test   %rdx,%rdx
je     114f <c_get_urandom_bytes+0x2f>
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @c_get_urandom_bytes(i8* nocapture %0, i64 %1, i32* %2) {
%4 = icmp eq i32* %2, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i64 @fread(i8* %0, i64 %1, i32 1, i32* %2)
%7 = tail call i32 @fclose(i32* %2)
br label %8
8: ; preds = %3, %5
%9 = phi i64 [ %6, %5 ], [ 0, %3 ]
ret i64 %9
}
int test_imm_0Cuint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x0C << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_0Cuint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 12
%6 = icmp ne i64 %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_0Cuint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 12
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void INT_Excep_RSPI0_SPRI0(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_RSPI0_SPRI0() {
ret void
}
float max3(float x, float y, float z) {
  if (y > x)
    x = y;
  if (z > x)
    x = z;
  return x;
}


x86 assembly (clang, -O0):
<max3>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    112c <max3+0x2c>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1145 <max3+0x45>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max3>:
maxss  %xmm0,%xmm1
maxss  %xmm1,%xmm2
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @max3(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 = fcmp ogt float %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load float, float* %5
store float %11, float* %4
br label %12
12: ; preds = %10, %3
%13 = load float, float* %6
%14 = load float, float* %4
%15 = fcmp ogt float %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load float, float* %6
store float %17, float* %4
br label %18
18: ; preds = %16, %12
%19 = load float, float* %4
ret float %19
}

LLVM IR (-O2):
define float @max3(float %0, float %1, float %2) {
%4 = fcmp ogt float %1, %0
%5 = select i1 %4, float %1, float %0
%6 = fcmp olt float %5, %2
%7 = select i1 %6, float %2, float %5
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ rdns_process_retransmit(int, void *);
void rdns_libevent_write_event(int fd, short what, void *ud) {
  rdns_process_retransmit(fd, ud);
}


x86 assembly (clang, -O0):
<rdns_libevent_write_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <rdns_process_retransmit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdns_libevent_write_event>:
mov    %rdx,%rsi
jmp    1030 <rdns_process_retransmit@plt>

LLVM IR (-O0):
define void @rdns_libevent_write_event(i32 %0, i16 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8*
store i32 %0, i32* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %6
%9 = call i32 @rdns_process_retransmit(i32 %7, i8* %8)
ret void
}

LLVM IR (-O2):
define void @rdns_libevent_write_event(i32 %0, i16 signext %1, i8* %2) {
%4 = tail call i32 @rdns_process_retransmit(i32 %0, i8* %2)
ret void
}
/* Variables and functions */
int my_sin(int);
int my_cos(int rad) { return (my_sin(3141 / 2 - rad)); }


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

x86 assembly (clang, -O2):
<my_cos>:
mov    $0x622,%eax
sub    %edi,%eax
mov    %eax,%edi
jmp    1030 <my_sin@plt>

LLVM IR (-O0):
define i32 @my_cos(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 1570, %3
%5 = call i32 @my_sin(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @my_cos(i32 %0) {
%2 = sub nsw i32 1570, %0
%3 = tail call i32 @my_sin(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const);
void printCharacters(const char *sPtr) {
  for (; *sPtr != '\0'; ++sPtr) {
    printf("%c", *sPtr);
  }
}


x86 assembly (clang, -O0):
<printCharacters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1150 <printCharacters+0x40>
mov    -0x8(%rbp),%rax
lea    0xec9(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <printCharacters+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printCharacters>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1146 <printCharacters+0x36>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xed8(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <printCharacters+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @printCharacters(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %12, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %10)
br label %12
12: ; preds = %8
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
br label %3
15: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @printCharacters(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
void XtSetEventDispatcher() {}


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

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

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

LLVM IR (-O2):
define void @XtSetEventDispatcher() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
scalar_t__ rename(char const *, char const *);
int /*<<< orphan*/ stderr;
int _bf_commit_snapshot(const char *src, const char *dst) {
  int ret = -1;
  if (rename(src, dst) == 0) {
    ret = 0;
  } else {
    fputs("Unable to rename inprogress snapshot into actual location.\n",
          stderr);
  }
  return ret;
}


x86 assembly (clang, -O0):
<_bf_commit_snapshot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <rename@plt>
cmp    $0x0,%rax
jne    115a <_bf_commit_snapshot+0x3a>
movl   $0x0,-0x14(%rbp)
jmp    116f <_bf_commit_snapshot+0x4f>
mov    0x2e7f(%rip),%rax
mov    (%rax),%esi
lea    0xe96(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_bf_commit_snapshot>:
push   %rax
call   1040 <rename@plt>
test   %rax,%rax
je     1147 <_bf_commit_snapshot+0x27>
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
lea    0xec5(%rip),%rdi
call   1030 <fputs@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Unable to rename inprogress snapshot into actual location.\0A\00"
@stderr = global i32 0
define i32 @_bf_commit_snapshot(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 -1, i32* %5
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i64 @rename(i8* %6, i8* %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %5
br label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fputs(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %10
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
@.str = [60 x i8] c"Unable to rename inprogress snapshot into actual location.\0A\00"
@stderr = global i32 0
define i32 @_bf_commit_snapshot(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @rename(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fputs(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ -1, %5 ], [ 0, %2 ]
ret i32 %9
}
void X509_ATTRIBUTE_get0_type(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_ATTRIBUTE_get0_type() {
ret void
}
/* Variables and functions */
char *strdup(char *);
char *strjoin_with_separator(char *, char *);
char *target_canonicalization(char *target, char *cwd) {
  char *res;
  if (target[0] == '/') {
    res = strdup(target);
  } else {
    res = strjoin_with_separator(cwd, target);
  }
  return res;
}


x86 assembly (clang, -O0):
<target_canonicalization>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1152 <target_canonicalization+0x32>
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x18(%rbp)
jmp    1163 <target_canonicalization+0x43>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strjoin_with_separator@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target_canonicalization>:
mov    %rdi,%rax
cmpb   $0x2f,(%rdi)
jne    1130 <target_canonicalization+0x10>
mov    %rax,%rdi
jmp    1040 <strdup@plt>
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <strjoin_with_separator@plt>

LLVM IR (-O0):
define i8* @target_canonicalization(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 47
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i8* @strdup(i8* %12)
store i8* %13, i8** %5
br label %18
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = load i8*, i8** %3
%17 = call i8* @strjoin_with_separator(i8* %15, i8* %16)
store i8* %17, i8** %5
br label %18
18: ; preds = %14, %11
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
define i8* @target_canonicalization(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 47
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i8* @strdup(i8* %0)
br label %9
7: ; preds = %2
%8 = tail call i8* @strjoin_with_separator(i8* %1, i8* %0)
br label %9
9: ; preds = %7, %5
%10 = phi i8* [ %6, %5 ], [ %8, %7 ]
ret i8* %10
}
/* Type definitions */
typedef int uint_fast8_t;

/* Variables and functions */
uint_fast8_t clamp(const int n) { return n < 0 ? 0 : n > 255 ? 255 : n; }


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111b <clamp+0x1b>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <clamp+0x41>
cmpl   $0xff,-0x4(%rbp)
jle    1135 <clamp+0x35>
mov    $0xff,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <clamp+0x3b>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
cmp    $0xff,%edi
mov    $0xff,%ecx
cmovl  %edi,%ecx
xor    %eax,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @clamp(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 255
br i1 %8, label %9, label %10
9: ; preds = %6
br label %12
10: ; preds = %6
%11 = load i32, i32* %2
br label %12
12: ; preds = %10, %9
%13 = phi i32 [ 255, %9 ], [ %11, %10 ]
br label %14
14: ; preds = %12, %5
%15 = phi i32 [ 0, %5 ], [ %13, %12 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @clamp(i32 %0) {
%2 = icmp slt i32 %0, 255
%3 = select i1 %2, i32 %0, i32 255
%4 = icmp sgt i32 %3, 0
%5 = select i1 %4, i32 %3, i32 0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void print_version() {
  fprintf(stdout,
          "# "
          "OpenSHMEM%s BENCHMARK NAME UNSET"
          "\n",
          "");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xee8(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_version>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
lea    0xeeb(%rip),%rdx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [36 x i8] c"# OpenSHMEM%s BENCHMARK NAME UNSET\0A\00"
@.str.1 = [1 x i8] zeroinitializer
define void @print_version() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [36 x i8] c"# OpenSHMEM%s BENCHMARK NAME UNSET\0A\00"
@.str.1 = [1 x i8] zeroinitializer
define void @print_version() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
/* Variables and functions */
char chrcaps(char);
char *strcaps(char *s) {
  char *ret = s;
  do
    *(s) = chrcaps(*(s));
  while (*(++s));
  return ret;
}


x86 assembly (clang, -O0):
<strcaps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <chrcaps@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,0x1(%rax)
jne    1124 <strcaps+0x14>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcaps>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
lea    0x1(%rdi),%rbx
nopl   (%rax)
movsbl %al,%edi
call   1030 <chrcaps@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <strcaps+0x10>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strcaps(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %10, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = call signext i8 @chrcaps(i8 signext %7)
%9 = load i8*, i8** %2
store i8 %8, i8* %9
br label %10
10: ; preds = %5
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %5, label %15
15: ; preds = %10
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @strcaps(i8* returned %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %3, %1
%4 = phi i8 [ %2, %1 ], [ %8, %3 ]
%5 = phi i8* [ %0, %1 ], [ %7, %3 ]
%6 = tail call signext i8 @chrcaps(i8 signext %4)
store i8 %6, i8* %5
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Type definitions */
struct tms {
  int dummy;
};

/* Variables and functions */
scalar_t__ times(struct tms *);
unsigned long now(void) {
  unsigned long time;
  struct tms dummy;
  time = (unsigned long)times(&dummy);
  return time;
}


x86 assembly (clang, -O0):
<now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
call   1030 <times@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now>:
push   %rax
mov    %rsp,%rdi
call   1030 <times@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.tms = type { i32 }
define i64 @now() {
%1 = alloca i64
%2 = alloca %struct.tms
%3 = call i64 @times(%struct.tms* %2)
store i64 %3, i64* %1
%4 = load i64, i64* %1
ret i64 %4
}

LLVM IR (-O2):
%struct.tms = type { i32 }
define i64 @now() {
%1 = alloca %struct.tms
%2 = bitcast %struct.tms* %1 to i8*
%3 = call i64 @times(%struct.tms* %1)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int projects_list_callback(char *project, int current) {
  if (current)
    printf("*%s\n", project);
  else
    printf("%s\n", project);
  return 0;
}


x86 assembly (clang, -O0):
<projects_list_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113e <projects_list_callback+0x2e>
mov    -0x8(%rbp),%rsi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
jmp    114e <projects_list_callback+0x3e>
mov    -0x8(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<projects_list_callback>:
push   %rax
mov    %rdi,%rax
test   %esi,%esi
lea    0xee4(%rip),%rcx
lea    0xedc(%rip),%rdi
cmove  %rcx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"*%s\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @projects_list_callback(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %13
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %10, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"*%s\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @projects_list_callback(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @printf(i8* %4, i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ handle_fatal_error(char *);
int open(char *, int /*<<< orphan*/);
int open_lockfile(const char *name) {
  int fd;
  fd = open("test_lock", O_RDWR);
  if (fd == -1) {
    handle_fatal_error("Error opening a file.\n");
  }
  return fd;
}


x86 assembly (clang, -O0):
<open_lockfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xec4(%rip),%rdi
call   1040 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    115a <open_lockfile+0x3a>
lea    0xeb5(%rip),%rdi
call   1030 <handle_fatal_error@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_lockfile>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <open@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1149 <open_lockfile+0x29>
lea    0xec6(%rip),%rdi
call   1030 <handle_fatal_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"test_lock\00"
@O_RDWR = global i32 0
@.str.1 = [23 x i8] c"Error opening a file.\0A\00"
define i32 @open_lockfile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i32, i32* @O_RDWR
%5 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @handle_fatal_error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [10 x i8] c"test_lock\00"
@O_RDWR = global i32 0
@.str.1 = [23 x i8] c"Error opening a file.\0A\00"
define i32 @open_lockfile(i8* nocapture readnone %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @handle_fatal_error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret i32 %3
}
void sleep(int ticks) {}


x86 assembly (clang, -O0):
<sleep>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @sleep(i32 %0) {
ret void
}
/* Type definitions */
struct struct_dll {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct struct_dll *);
int /*<<< orphan*/ printf(char *);
void free_struct_dll(struct struct_dll *s) {
  printf("free_struct_dll 1\n");
  free(s);
}


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

x86 assembly (clang, -O2):
<free_struct_dll>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.struct_dll = type { i32 }
@.str = [19 x i8] c"free_struct_dll 1\0A\00"
define void @free_struct_dll(%struct.struct_dll* %0) {
%2 = alloca %struct.struct_dll*
store %struct.struct_dll* %0, %struct.struct_dll** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.struct_dll*, %struct.struct_dll** %2
%5 = call i32 @free(%struct.struct_dll* %4)
ret void
}

LLVM IR (-O2):
%struct.struct_dll = type { i32 }
@str = [18 x i8] c"free_struct_dll 1\00"
define void @free_struct_dll(%struct.struct_dll* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @free(%struct.struct_dll* %0)
ret void
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dsemyc(int, int, double *, int);
int main() {
  double x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  double v = stdlib_strided_dsemyc(N, 1, x, stride);
  printf("standard error of the mean: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
movl   $0x4,-0x44(%rbp)
movl   $0x2,-0x48(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%ecx
mov    $0x1,%esi
call   1050 <stdlib_strided_dsemyc@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdx
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0x2,%ecx
call   1040 <stdlib_strided_dsemyc@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [33 x i8] c"standard error of the mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [8 x double]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dsemyc(i32 %6, i32 1, double* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [33 x i8] c"standard error of the mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dsemyc(i32 4, i32 1, double* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ switch_green(int);
int /*<<< orphan*/ switch_red(int);
bool set_status_led_sn4(bool running) {
  if (running) {
    switch_red(false);
    switch_green(true);
  } else {
    switch_green(false);
    switch_red(true);
  }
  return true;
}


x86 assembly (clang, -O0):
<set_status_led_sn4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114b <set_status_led_sn4+0x2b>
xor    %edi,%edi
call   1040 <switch_red@plt>
mov    $0x1,%edi
call   1030 <switch_green@plt>
jmp    115c <set_status_led_sn4+0x3c>
xor    %edi,%edi
call   1030 <switch_green@plt>
mov    $0x1,%edi
call   1040 <switch_red@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_status_led_sn4>:
push   %rax
test   %edi,%edi
je     1138 <set_status_led_sn4+0x18>
xor    %edi,%edi
call   1040 <switch_red@plt>
mov    $0x1,%edi
call   1030 <switch_green@plt>
jmp    1149 <set_status_led_sn4+0x29>
xor    %edi,%edi
call   1030 <switch_green@plt>
mov    $0x1,%edi
call   1040 <switch_red@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @set_status_led_sn4(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @switch_red(i32 0)
%5 = tail call i32 @switch_green(i32 1)
br label %9
6: ; preds = %1
%7 = tail call i32 @switch_green(i32 0)
%8 = tail call i32 @switch_red(i32 1)
br label %9
9: ; preds = %6, %3
ret i32 1
}
int test_imm_AAint16_reg(short val) {
  return ((val) & (-0xAA << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_AAint16_reg>:
test   $0xff56,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_AAint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -170
%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_AAint16_reg(i16 signext %0) {
%2 = and i16 %0, -170
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}