xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ CharDoubleOp(char);
scalar_t__ CharSimpleOp(char);
int CharOp(char c) { return CharSimpleOp(c) || CharDoubleOp(c); }


x86 assembly (clang, -O0):
<CharOp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <CharSimpleOp@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115c <CharOp+0x3c>
movsbl -0x1(%rbp),%edi
call   1030 <CharDoubleOp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CharOp>:
push   %rbx
mov    %edi,%ebx
call   1040 <CharSimpleOp@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <CharOp+0x17>
pop    %rbx
ret
movsbl %bl,%edi
call   1030 <CharDoubleOp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @CharOp(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @CharSimpleOp(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @CharDoubleOp(i8 signext %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @CharOp(i8 signext %0) {
%2 = tail call i64 @CharSimpleOp(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @CharDoubleOp(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ fibonacci(int);
void spiral(void) { fibonacci(1); }


x86 assembly (clang, -O0):
<spiral>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <fibonacci@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<spiral>:
mov    $0x1,%edi
jmp    1030 <fibonacci@plt>

LLVM IR (-O0):
define void @spiral() {
%1 = call i32 @fibonacci(i32 1)
ret void
}

LLVM IR (-O2):
define void @spiral() {
%1 = tail call i32 @fibonacci(i32 1)
ret void
}
int main() {
  int i = 0;
  do
    i++;
  while (i < 10);
  while (i)
    i--;
  return i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jl     1112 <main+0x12>
jmp    112a <main+0x2a>
cmpl   $0x0,-0x8(%rbp)
je     1142 <main+0x42>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    112a <main+0x2a>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void rc5_advance_space(unsigned *buf, unsigned *n, unsigned length) {
  if (*n % 2)
    buf[*n] += length;
  else
    buf[++(*n)] = length;
}


x86 assembly (clang, -O0):
<rc5_advance_space>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1139 <rc5_advance_space+0x39>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
add    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
jmp    1150 <rc5_advance_space+0x50>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rsi
mov    (%rsi),%ecx
add    $0x1,%ecx
mov    %ecx,(%rsi)
mov    %ecx,%ecx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc5_advance_space>:
mov    (%rsi),%eax
test   $0x1,%al
jne    1110 <rc5_advance_space+0x10>
lea    0x1(%rax),%ecx
mov    %ecx,(%rsi)
mov    %edx,0x4(%rdi,%rax,4)
ret
add    %edx,(%rdi,%rax,4)
ret

LLVM IR (-O0):
define void @rc5_advance_space(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** %5
%8 = load i32, i32* %7
%9 = urem i32 %8, 2
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %3
%12 = load i32, i32* %6
%13 = load i32*, i32** %4
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %13, i64 %16
%18 = load i32, i32* %17
%19 = add i32 %18, %12
store i32 %19, i32* %17
br label %28
20: ; preds = %3
%21 = load i32, i32* %6
%22 = load i32*, i32** %4
%23 = load i32*, i32** %5
%24 = load i32, i32* %23
%25 = add i32 %24, 1
store i32 %25, i32* %23
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %22, i64 %26
store i32 %21, i32* %27
br label %28
28: ; preds = %20, %11
ret void
}

LLVM IR (-O2):
define void @rc5_advance_space(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %1
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = zext i32 %4 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = add i32 %10, %2
store i32 %11, i32* %9
br label %16
12: ; preds = %3
%13 = add nuw i32 %4, 1
store i32 %13, i32* %1
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %0, i64 %14
store i32 %2, i32* %15
br label %16
16: ; preds = %12, %7
ret void
}
int getBitL(int A, int k) { return ((A & (0x80000000 >> k)) != 0); }


x86 assembly (clang, -O0):
<getBitL>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x80000000,%edx
shr    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBitL>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @getBitL(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = lshr i32 -2147483648, %6
%8 = and i32 %5, %7
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @getBitL(i32 %0, i32 %1) {
%3 = lshr i32 -2147483648, %1
%4 = and i32 %3, %0
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
double POP();
int /*<<< orphan*/ PUSH(double);
void s_div(void) {
  double x;
  x = POP();
  PUSH(POP() / x);
}


x86 assembly (clang, -O0):
<s_div>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <POP@plt>
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <POP@plt>
divsd  -0x8(%rbp),%xmm0
call   1040 <PUSH@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_div>:
push   %rax
xor    %eax,%eax
call   1030 <POP@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <POP@plt>
divsd  (%rsp),%xmm0
pop    %rax
jmp    1040 <PUSH@plt>

LLVM IR (-O0):
define void @s_div() {
%1 = alloca double
%2 = call double (...) @POP()
store double %2, double* %1
%3 = call double (...) @POP()
%4 = load double, double* %1
%5 = fdiv double %3, %4
%6 = call i32 @PUSH(double %5)
ret void
}

LLVM IR (-O2):
define void @s_div() {
%1 = tail call double (...) @POP()
%2 = tail call double (...) @POP()
%3 = fdiv double %2, %1
%4 = tail call i32 @PUSH(double %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ function(char);
void main() { function('a'); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x61,%edi
call   1030 <function@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x61,%edi
jmp    1030 <function@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 @function(i8 signext 97)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @function(i8 signext 97)
ret void
}
/* Variables and functions */
unsigned long long mf__mem_total();
unsigned long long mem_total(void) {
  unsigned long long r_ull = 0;
  ;
  r_ull = mf__mem_total();
  ;
  return (r_ull);
}


x86 assembly (clang, -O0):
<mem_total>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <mf__mem_total@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @mem_total() {
%1 = alloca i64
store i64 0, i64* %1
%2 = call i64 (...) @mf__mem_total()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @mem_total() {
%1 = tail call i64 (...) @mf__mem_total()
ret i64 %1
}
/* Variables and functions */
int RAND_MAX;
int rand();
int randRange(int n) {
  int limit;
  int r;
  limit = RAND_MAX - (RAND_MAX % n);
  while ((r = rand()) >= limit)
    ;
  return r % n;
}


x86 assembly (clang, -O0):
<randRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%eax
cltd
idivl  -0x4(%rbp)
mov    -0x10(%rbp),%eax
sub    %edx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0xc(%rbp)
cmp    -0x8(%rbp),%eax
jl     1154 <randRange+0x44>
jmp    113c <randRange+0x2c>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randRange>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ecc(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%eax
cltd
idiv   %edi
sub    %edx,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <rand@plt>
cmp    %ebp,%eax
jge    1130 <randRange+0x20>
cltd
idiv   %ebx
mov    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @randRange(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* @RAND_MAX
%6 = load i32, i32* @RAND_MAX
%7 = load i32, i32* %2
%8 = srem i32 %6, %7
%9 = sub nsw i32 %5, %8
store i32 %9, i32* %3
br label %10
10: ; preds = %14, %1
%11 = call i32 (...) @rand()
store i32 %11, i32* %4
%12 = load i32, i32* %3
%13 = icmp sge i32 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %10
br label %10
15: ; preds = %10
%16 = load i32, i32* %4
%17 = load i32, i32* %2
%18 = srem i32 %16, %17
ret i32 %18
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @randRange(i32 %0) {
%2 = load i32, i32* @RAND_MAX
%3 = srem i32 %2, %0
%4 = sub nsw i32 %2, %3
br label %5
5: ; preds = %5, %1
%6 = tail call i32 (...) @rand()
%7 = icmp slt i32 %6, %4
br i1 %7, label %8, label %5
8: ; preds = %5
%9 = srem i32 %6, %0
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *strdup(char *);
void set_or_replace(char **var, char *value) {
  if (*var)
    free(*var);
  if (value)
    *var = strdup(value);
  else
    *var = NULL;
}


x86 assembly (clang, -O0):
<set_or_replace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114a <set_or_replace+0x2a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x10(%rbp)
je     116d <set_or_replace+0x4d>
mov    -0x10(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1178 <set_or_replace+0x58>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_or_replace>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1137 <set_or_replace+0x17>
call   1030 <free@plt>
test   %rbx,%rbx
je     1146 <set_or_replace+0x26>
mov    %rbx,%rdi
call   1040 <strdup@plt>
jmp    1148 <set_or_replace+0x28>
xor    %eax,%eax
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @set_or_replace(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 = load i8*, i8** %5
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = call i32 @free(i8* %10)
br label %12
12: ; preds = %8, %2
%13 = load i8*, i8** %4
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8*, i8** %4
%17 = call i8* @strdup(i8* %16)
%18 = load i8**, i8*** %3
store i8* %17, i8** %18
br label %21
19: ; preds = %12
%20 = load i8**, i8*** %3
store i8* null, i8** %20
br label %21
21: ; preds = %19, %15
ret void
}

LLVM IR (-O2):
define void @set_or_replace(i8** nocapture %0, i8* %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @free(i8* %3)
br label %7
7: ; preds = %5, %2
%8 = icmp eq i8* %1, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i8* @strdup(i8* %1)
br label %11
11: ; preds = %7, %9
%12 = phi i8* [ %10, %9 ], [ null, %7 ]
store i8* %12, i8** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  (void)fprintf(stderr, "usage: wc [-clmw] [file ...]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"usage: wc [-clmw] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"usage: wc [-clmw] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int Error(char *, int);
int ResultD(int);
int IntOrError(int e, char **argv, int x) {
  if (e)
    return Error(argv[0], e);
  return ResultD(x);
}


x86 assembly (clang, -O0):
<IntOrError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1153 <IntOrError+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%esi
call   1030 <Error@plt>
mov    %eax,-0x4(%rbp)
jmp    115e <IntOrError+0x3e>
mov    -0x14(%rbp),%edi
call   1040 <ResultD@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IntOrError>:
test   %edi,%edi
je     1130 <IntOrError+0x10>
mov    %edi,%eax
mov    (%rsi),%rdi
mov    %eax,%esi
jmp    1030 <Error@plt>
mov    %edx,%edi
jmp    1040 <ResultD@plt>

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

LLVM IR (-O2):
define i32 @IntOrError(i32 %0, i8** nocapture %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = load i8*, i8** %1
%7 = tail call i32 @Error(i8* %6, i32 %0)
br label %10
8: ; preds = %3
%9 = tail call i32 @ResultD(i32 %2)
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %7, %5 ], [ %9, %8 ]
ret i32 %11
}
int creat(s, m)
char *s;
{ return (0); }


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

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

LLVM IR (-O0):
define i32 @creat(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @creat(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
char *sigar_uitoa(char *buf, unsigned int n, int *len) {
  char *start = buf + (sizeof(int) * 3 + 1) - 1;
  *start = 0;
  do {
    *--start = '0' + (n % 10);
    ++*len;
    n /= 10;
  } while (n);
  return start;
}


x86 assembly (clang, -O0):
<sigar_uitoa>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0xd,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1126 <sigar_uitoa+0x26>
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigar_uitoa>:
mov    %rdi,%rax
movb   $0x0,0xc(%rdi)
add    $0xc,%rax
mov    $0xcccccccd,%r8d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %esi,%edi
imul   %r8,%rdi
shr    $0x23,%rdi
lea    (%rdi,%rdi,1),%ecx
lea    (%rcx,%rcx,4),%r9d
mov    %esi,%ecx
sub    %r9d,%ecx
or     $0x30,%cl
mov    %cl,-0x1(%rax)
add    $0xffffffffffffffff,%rax
addl   $0x1,(%rdx)
cmp    $0x9,%esi
mov    %edi,%esi
ja     1120 <sigar_uitoa+0x20>
ret

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

LLVM IR (-O2):
define i8* @sigar_uitoa(i8* writeonly %0, i32 %1, i32* nocapture %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 12
store i8 0, i8* %4
br label %5
5: ; preds = %5, %3
%6 = phi i32 [ %1, %3 ], [ %14, %5 ]
%7 = phi i8* [ %4, %3 ], [ %11, %5 ]
%8 = urem i32 %6, 10
%9 = trunc i32 %8 to i8
%10 = or i8 %9, 48
%11 = getelementptr inbounds i8, i8* %7, i64 -1
store i8 %10, i8* %11
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
%14 = udiv i32 %6, 10
%15 = icmp ult i32 %6, 10
br i1 %15, label %16, label %5
16: ; preds = %5
ret i8* %11
}
char *colored(char *str) {
  static char ret[64];
  char *c = str;
  char *d = ret;
  while (*c)
    *d++ = *c++ + 128;
  *d = '\0';
  return ret;
}


x86 assembly (clang, -O0):
<colored>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0x2f19(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1157 <colored+0x57>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
add    $0x80,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    111b <colored+0x1b>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2ecb(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<colored>:
mov    (%rdi),%cl
test   %cl,%cl
je     1136 <colored+0x36>
add    $0x1,%rdi
lea    0x2f1f(%rip),%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    $0x80,%cl
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1120 <colored+0x20>
jmp    113d <colored+0x3d>
lea    0x2ef3(%rip),%rax
movb   $0x0,(%rax)
lea    0x2ee9(%rip),%rax
ret

LLVM IR (-O0):
@colored.ret = internal global [64 x i8] zeroinitializer
define i8* @colored(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @colored.ret, i64 0, i64 0), i8** %4
br label %6
6: ; preds = %10, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = add nsw i32 %14, 128
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %4
store i8 %16, i8* %17
br label %6
19: ; preds = %6
%20 = load i8*, i8** %4
store i8 0, i8* %20
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @colored.ret, i64 0, i64 0)
}

LLVM IR (-O2):
@colored.ret = internal global [64 x i8] zeroinitializer
define i8* @colored(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i8* [ %10, %4 ], [ getelementptr inbounds ([64 x i8], [64 x i8]* @colored.ret, i64 0, i64 0), %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = xor i8 %5, -128
%10 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %9, i8* %6
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = phi i8* [ getelementptr inbounds ([64 x i8], [64 x i8]* @colored.ret, i64 0, i64 0), %1 ], [ %10, %4 ]
store i8 0, i8* %14
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @colored.ret, i64 0, i64 0)
}
unsigned xrop3_215_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T ^ S;
  stk1 = D & stk2;
  stk1 = ~stk1;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_215_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_215_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
xor    %esi,%edi
not    %edi
not    %ecx
or     %eax,%ecx
and    %edi,%ecx
not    %eax
and    %esi,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @xrop3_215_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i8 %1, %0
%8 = zext i8 %7 to i32
%9 = xor i32 %8, -1
%10 = xor i32 %6, -1
%11 = or i32 %4, %10
%12 = and i32 %11, %9
%13 = xor i32 %4, -1
%14 = and i32 %13, %5
%15 = or i32 %12, %14
ret i32 %15
}
/* Variables and functions */
long sysconf(int);
size_t get_hostname_max(void) {
  long len = sysconf(255);
  if (0 < len)
    return len;
  return 64;
}


x86 assembly (clang, -O0):
<get_hostname_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xff,%edi
call   1030 <sysconf@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jge    113f <get_hostname_max+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1147 <get_hostname_max+0x37>
movq   $0x40,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hostname_max>:
push   %rax
mov    $0xff,%edi
call   1030 <sysconf@plt>
test   %rax,%rax
mov    $0x40,%ecx
cmovle %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @get_hostname_max() {
%1 = alloca i64
%2 = alloca i64
%3 = call i64 @sysconf(i32 255)
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = icmp slt i64 0, %4
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = load i64, i64* %2
store i64 %7, i64* %1
br label %9
8: ; preds = %0
store i64 64, i64* %1
br label %9
9: ; preds = %8, %6
%10 = load i64, i64* %1
ret i64 %10
}

LLVM IR (-O2):
define i64 @get_hostname_max() {
%1 = tail call i64 @sysconf(i32 255)
%2 = icmp sgt i64 %1, 0
%3 = select i1 %2, i64 %1, i64 64
ret i64 %3
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  unsigned long parent;
};
struct TYPE_4__ {
  TYPE_1__ xcreatewindow;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xcreatewindow_parent(void *_p, unsigned long _v) {
  ((XEvent *)_p)->xcreatewindow.parent = (unsigned long)_v;
}


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

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

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

LLVM IR (-O2):
define void @set_XEvent_xcreatewindow_parent(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
__attribute__((transaction_callable, no)) void foobar() {}


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

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

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

LLVM IR (-O2):
define void @foobar() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ exit(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int openFile(char *fv) {
  int dskr = open(fv, O_RDONLY);
  if (dskr == -1) {
    printf("Failed to open file: %s\n", fv);
    exit(1);
  }
  return dskr;
}


x86 assembly (clang, -O0):
<openFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1175 <openFile+0x45>
mov    -0x8(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openFile>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
cmp    $0xffffffff,%eax
je     1149 <openFile+0x19>
pop    %rbx
ret
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [25 x i8] c"Failed to open file: %s\0A\00"
define i32 @openFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDONLY
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [25 x i8] c"Failed to open file: %s\0A\00"
define i32 @openFile(i8* %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void DefaultPath(char *path, char *basepath) {
  char temp[128];
  if (path[0] == '/') {
    return;
  }
  strcpy(temp, path);
  strcpy(path, basepath);
  strcat(path, temp);
}


x86 assembly (clang, -O0):
<DefaultPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1148 <DefaultPath+0x28>
jmp    1175 <DefaultPath+0x55>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DefaultPath>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
cmpb   $0x2f,(%rdi)
je     115b <DefaultPath+0x3b>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @DefaultPath(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [128 x 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 %12
11: ; preds = %2
br label %22
12: ; preds = %2
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %3
%17 = load i8*, i8** %4
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = load i8*, i8** %3
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%21 = call i32 @strcat(i8* %19, i8* %20)
br label %22
22: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @DefaultPath(i8* %0, i8* %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 47
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = call i32 @strcpy(i8* %4, i8* %0)
%9 = call i32 @strcpy(i8* %0, i8* %1)
%10 = call i32 @strcat(i8* %0, i8* %4)
br label %11
11: ; preds = %2, %7
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void *tag_u32(uint32_t x) { return (void *)((uintptr_t)((x << 1) | 1)); }


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

x86 assembly (clang, -O2):
<tag_u32>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
cltq
ret

LLVM IR (-O0):
define i8* @tag_u32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 1
%5 = or i32 %4, 1
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @tag_u32(i32 %0) {
%2 = shl i32 %0, 1
%3 = or i32 %2, 1
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
double degrees(double radians) {
  return radians * 180 / 3.14159265358979323846;
}


x86 assembly (clang, -O0):
<degrees>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<degrees>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @degrees(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.800000e+02
%5 = fdiv double %4, 0x400921FB54442D18
ret double %5
}

LLVM IR (-O2):
define double @degrees(double %0) {
%2 = fmul double %0, 1.800000e+02
%3 = fdiv double %2, 0x400921FB54442D18
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ alphabet_test();
void main() { alphabet_test(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <alphabet_test@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @alphabet_test()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @alphabet_test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(char);
int istroff(char *s) { return (*s == '.' && !isdigit(*(s + 1))); }


x86 assembly (clang, -O0):
<istroff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2e,%ecx
mov    %al,-0x9(%rbp)
jne    1149 <istroff+0x39>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<istroff>:
push   %rax
xor    %eax,%eax
cmpb   $0x2e,(%rdi)
jne    112a <istroff+0x1a>
movsbl 0x1(%rdi),%edi
call   1030 <isdigit@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @istroff(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 46
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = call i32 @isdigit(i8 signext %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br label %14
14: ; preds = %7, %1
%15 = phi i1 [ false, %1 ], [ %13, %7 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @istroff(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 46
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @isdigit(i8 signext %6)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %4, %1
%11 = phi i32 [ 0, %1 ], [ %9, %4 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
void leVETOR(int vector[], int n) {
  int i;
  for (i = 0; i < n; ++i)
    scanf("%d", &vector[i]);
}


x86 assembly (clang, -O0):
<leVETOR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115b <leVETOR+0x4b>
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeb8(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <leVETOR+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leVETOR>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1145 <leVETOR+0x35>
mov    %rdi,%rbx
mov    %esi,%r15d
lea    0xeda(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r15
jne    1130 <leVETOR+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @leVETOR(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
int immediate_addressing(base) {
  int address_bits = 0b0000000000001111;
  int negative = 0b0000000000010000;
  int number = address_bits & base;
  int n_check = negative & base;
  if (n_check == 0b0000000000010000) {
    number = number - 0b10000;
    printf("%d\n", number);
  } else {
    printf("%d\n", number);
  }
  return 0;
}


x86 assembly (clang, -O0):
<immediate_addressing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
movl   $0x10,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jne    1164 <immediate_addressing+0x54>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1175 <immediate_addressing+0x65>
mov    -0x10(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<immediate_addressing>:
push   %rax
mov    %edi,%esi
shl    $0x1b,%esi
sar    $0x1f,%esi
and    $0xf,%edi
and    $0xfffffff0,%esi
or     %edi,%esi
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @immediate_addressing(i32 %0) {
%2 = and i32 %0, 16
%3 = icmp eq i32 %2, 0
%4 = and i32 %0, 15
%5 = select i1 %3, i32 0, i32 -16
%6 = or i32 %4, %5
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *find_embedded_file(char *, size_t *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/ *);
int mkpage(void) {
  size_t size;
  const char *data = find_embedded_file("test/syntax.md", &size);
  FILE *fp = fopen(".journal/posts/syntax.md", "w+");
  fputs(data, fp);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<mkpage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <find_embedded_file@plt>
mov    %rax,-0x10(%rbp)
lea    0xeac(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkpage>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
mov    %rsp,%rsi
call   1050 <find_embedded_file@plt>
mov    %rax,%r14
lea    0xeb2(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"test/syntax.md\00"
@.str.1 = [25 x i8] c".journal/posts/syntax.md\00"
@.str.2 = [3 x i8] c"w+\00"
define i32 @mkpage() {
%1 = alloca i64
%2 = alloca i8*
%3 = alloca i32*
%4 = call i8* @find_embedded_file(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64* %1)
store i8* %4, i8** %2
%5 = call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i8*, i8** %2
%7 = load i32*, i32** %3
%8 = call i32 @fputs(i8* %6, i32* %7)
%9 = load i32*, i32** %3
%10 = call i32 @fclose(i32* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"test/syntax.md\00"
@.str.1 = [25 x i8] c".journal/posts/syntax.md\00"
@.str.2 = [3 x i8] c"w+\00"
define i32 @mkpage() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i8* @find_embedded_file(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @fputs(i8* %3, i32* %4)
%6 = call i32 @fclose(i32* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ getopt_int(char *, char *);
int /*<<< orphan*/ unsetoption(char *, char *);
void unsetbgdot() {
  if (!getopt_int("term", "bgdot"))
    unsetoption("term", "bgdot");
}


x86 assembly (clang, -O0):
<unsetbgdot>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1030 <getopt_int@plt>
cmp    $0x0,%eax
jne    1153 <unsetbgdot+0x33>
lea    0xeb9(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1040 <unsetoption@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsetbgdot>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <getopt_int@plt>
test   %eax,%eax
je     113a <unsetbgdot+0x1a>
pop    %rax
ret
lea    0xebf(%rip),%rdi
lea    0xebd(%rip),%rsi
pop    %rax
jmp    1040 <unsetoption@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"term\00"
@.str.1 = [6 x i8] c"bgdot\00"
define void @unsetbgdot() {
%1 = call i32 @getopt_int(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp ne i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = call i32 @unsetoption(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"term\00"
@.str.1 = [6 x i8] c"bgdot\00"
define void @unsetbgdot() {
%1 = tail call i32 @getopt_int(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @unsetoption(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}
unsigned char f64(unsigned char x, unsigned long int y) {
  return (x << ((-y) & (8 * sizeof(unsigned char) - 1))) ^ (x >> y);
}


x86 assembly (clang, -O0):
<f64>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    $0x7,%rcx
shl    %cl,%eax
movzbl -0x1(%rbp),%edx
mov    -0x10(%rbp),%rcx
sar    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f64>:
mov    %esi,%ecx
neg    %cl
and    $0x7,%cl
mov    %edi,%eax
shl    %cl,%eax
mov    %esi,%ecx
shr    %cl,%edi
xor    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @f64(i8 zeroext %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 = zext i8 %5 to i32
%7 = load i64, i64* %4
%8 = sub i64 0, %7
%9 = and i64 %8, 7
%10 = trunc i64 %9 to i32
%11 = shl i32 %6, %10
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = load i64, i64* %4
%15 = trunc i64 %14 to i32
%16 = ashr i32 %13, %15
%17 = xor i32 %11, %16
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
define zeroext i8 @f64(i8 zeroext %0, i64 %1) {
%3 = zext i8 %0 to i32
%4 = trunc i64 %1 to i32
%5 = sub i32 0, %4
%6 = and i32 %5, 7
%7 = shl nuw nsw i32 %3, %6
%8 = lshr i32 %3, %4
%9 = xor i32 %7, %8
%10 = trunc i32 %9 to i8
ret i8 %10
}