xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ test(char *, char *);
void TEST_while_stmt(void) {
  test("54321a", "main(){int i=5; while (i) { printf(\"%d\", i); i=i-1; } "
                 "printf(\"a\");}");
  test("54321a", "main(){int i=5; while (i)   printf(\"%d\", i), i=i-1;   "
                 "printf(\"a\");}");
}


x86 assembly (clang, -O0):
<TEST_while_stmt>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee5(%rip),%rsi
call   1030 <test@plt>
lea    0xed2(%rip),%rdi
lea    0xf16(%rip),%rsi
call   1030 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_while_stmt>:
push   %rbx
lea    0xee8(%rip),%rbx
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test@plt>
lea    0xf1d(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <test@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"54321a\00"
@.str.1 = [68 x i8] c"main(){int i=5; while (i) { printf(\22%d\22, i); i=i-1; } printf(\22a\22);}\00"
@.str.2 = [68 x i8] c"main(){int i=5; while (i) printf(\22%d\22, i), i=i-1; printf(\22a\22);}\00"
define void @TEST_while_stmt() {
%1 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"54321a\00"
@.str.1 = [68 x i8] c"main(){int i=5; while (i) { printf(\22%d\22, i); i=i-1; } printf(\22a\22);}\00"
@.str.2 = [68 x i8] c"main(){int i=5; while (i) printf(\22%d\22, i), i=i-1; printf(\22a\22);}\00"
define void @TEST_while_stmt() {
%1 = tail call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init(int *, int);
int /*<<< orphan*/ print(int *, int);
int /*<<< orphan*/ qsort(int *, int /*<<< orphan*/, int);
int main(void) {
  int x[1024];
  init(x, 1024);
  qsort(x, 0, 1024 - 1);
  print(x, 1024);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1010(%rbp),%rdi
mov    $0x400,%esi
call   1050 <init@plt>
lea    -0x1010(%rbp),%rdi
xor    %esi,%esi
mov    $0x3ff,%edx
call   1030 <qsort@plt>
lea    -0x1010(%rbp),%rdi
mov    $0x400,%esi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1000,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <init@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x3ff,%edx
call   1030 <qsort@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x1000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%4 = call i32 @init(i32* %3, i32 1024)
%5 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%6 = call i32 @qsort(i32* %5, i32 0, i32 1023)
%7 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%8 = call i32 @print(i32* %7, i32 1024)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1024 x i32]
%2 = bitcast [1024 x i32]* %1 to i8*
%3 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 0
%4 = call i32 @init(i32* %3, i32 1024)
%5 = call i32 @qsort(i32* %3, i32 0, i32 1023)
%6 = call i32 @print(i32* %3, i32 1024)
ret i32 0
}
__attribute__((const)) char *deconst_string(const char *p) {
  union {
    const char *in;
    char *out;
  } u = {
      .in = p,
  };
  return u.out;
}


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

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

LLVM IR (-O0):
%union.anon = type { i8* }
define i8* @deconst_string(i8* %0) {
%2 = alloca i8*
%3 = alloca %union.anon
store i8* %0, i8** %2
%4 = bitcast %union.anon* %3 to i8**
%5 = load i8*, i8** %2
store i8* %5, i8** %4
%6 = bitcast %union.anon* %3 to i8**
%7 = load i8*, i8** %6
ret i8* %7
}

LLVM IR (-O2):
define i8* @deconst_string(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
void clear_buffer(unsigned char *buff, size_t len) {
  for (size_t i = 0; i < len; i++) {
    buff[i] = 0;
  }
}


x86 assembly (clang, -O0):
<clear_buffer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    113f <clear_buffer+0x3f>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <clear_buffer+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_buffer>:
test   %rsi,%rsi
je     1124 <clear_buffer+0x14>
push   %rax
mov    %rsi,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @clear_buffer(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %14, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds i8, i8* %11, i64 %12
store i8 0, i8* %13
br label %14
14: ; preds = %10
%15 = load i64, i64* %5
%16 = add i64 %15, 1
store i64 %16, i64* %5
br label %6
17: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @clear_buffer(i8* nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %5, label %4
4: ; preds = %2
br label %5
5: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(char const *, int /*<<< orphan*/, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ writeu16(int /*<<< orphan*/ *, int /*<<< orphan*/);
bool writelv(FILE *fp, uint16_t len, const char *val) {
  if (!writeu16(fp, len) || fwrite(val, len, 1, fp) != 1)
    return false;
  return true;
}


x86 assembly (clang, -O0):
<writelv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <writeu16@plt>
cmp    $0x0,%eax
je     1166 <writelv+0x46>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fwrite@plt>
cmp    $0x1,%eax
je     1172 <writelv+0x52>
movl   $0x0,-0x4(%rbp)
jmp    1179 <writelv+0x59>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writelv>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <writeu16@plt>
test   %eax,%eax
je     1153 <writelv+0x33>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
jmp    1155 <writelv+0x35>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @writelv(i32* %0, i32 %1, i8* nocapture %2) {
%4 = tail call i32 @writeu16(i32* %0, i32 %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @fwrite(i8* %2, i32 %1, i32 1, i32* %0)
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ 0, %3 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/);
void _exit(int z) {
  syscall(1, z, 0, 0, 0, 0);
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1030 <syscall@plt>
jmp    1134 <_exit+0x24>

x86 assembly (clang, -O2):
<_exit>:
push   %rax
mov    %edi,%esi
mov    $0x1,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <syscall@plt>
nopw   0x0(%rax,%rax,1)
jmp    1130 <_exit+0x20>

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @syscall(i32 1, i32 %3, i32 0, i32 0, i32 0, i32 0)
br label %5
5: ; preds = %5, %1
br label %5
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
%2 = tail call i32 @syscall(i32 1, i32 %0, i32 0, i32 0, i32 0, i32 0)
br label %3
3: ; preds = %3, %1
br label %3
}
int binary(const unsigned char source[], int length, int position) {
  int retval = 0;
  if (position < length && source[position] >= 128) {
    retval = 1;
  }
  return retval;
}


x86 assembly (clang, -O0):
<binary>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113f <binary+0x3f>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x80,%eax
jl     113f <binary+0x3f>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<binary>:
xor    %eax,%eax
cmp    %esi,%edx
jge    1110 <binary+0x10>
movslq %edx,%rax
movzbl (%rdi,%rax,1),%eax
shr    $0x7,%eax
ret

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

LLVM IR (-O2):
define i32 @binary(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, %1
br i1 %4, label %5, label %11
5: ; preds = %3
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = lshr i8 %8, 7
%10 = zext i8 %9 to i32
br label %11
11: ; preds = %5, %3
%12 = phi i32 [ 0, %3 ], [ %10, %5 ]
ret i32 %12
}
/* Type definitions */
typedef int uint32_t;
typedef int int8_t;

/* Variables and functions */
uint32_t rotl(uint32_t x, int8_t r) { return (x << r) | (x >> (32 - r)); }


x86 assembly (clang, -O0):
<rotl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotl>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
sar    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rotl(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 = shl i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 32, %9
%11 = ashr i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rotl(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = ashr i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ BlockEmpty(int, int);
int ContainsBlock(int x, int y) { return !BlockEmpty(x, y); }


x86 assembly (clang, -O0):
<ContainsBlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <BlockEmpty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ContainsBlock>:
push   %rax
call   1030 <BlockEmpty@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ContainsBlock(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 = call i32 @BlockEmpty(i32 %5, i32 %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @ContainsBlock(i32 %0, i32 %1) {
%3 = tail call i32 @BlockEmpty(i32 %0, i32 %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void _set_ident(unsigned char *u) { u[2] |= (1 << 1); }


x86 assembly (clang, -O0):
<_set_ident>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%ecx
or     $0x2,%ecx
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_ident>:
orb    $0x2,0x2(%rdi)
ret

LLVM IR (-O0):
define void @_set_ident(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 2
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = or i32 %6, 2
%8 = trunc i32 %7 to i8
store i8 %8, i8* %4
ret void
}

LLVM IR (-O2):
define void @_set_ident(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = load i8, i8* %2
%4 = or i8 %3, 2
store i8 %4, i8* %2
ret void
}
unsigned int pascal(unsigned int l, unsigned int c) {
  if (c > l) {
    return 0;
  }
  if (!c) {
    return 1;
  }
  return pascal(l - 1, c - 1) + pascal(l - 1, c);
}


x86 assembly (clang, -O0):
<pascal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    1136 <pascal+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1178 <pascal+0x68>
cmpl   $0x0,-0xc(%rbp)
jne    114c <pascal+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1178 <pascal+0x68>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <pascal@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1030 <pascal@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pascal>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r14d,%r14d
cmp    %edi,%esi
ja     1158 <pascal+0x48>
mov    %esi,%r12d
mov    %edi,%ebp
lea    -0x1(%r12),%r15d
xor    %r14d,%r14d
xor    %ebx,%ebx
xchg   %ax,%ax
test   %r12d,%r12d
je     1150 <pascal+0x40>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r15d,%esi
call   1030 <pascal@plt>
add    %eax,%ebx
cmp    %r12d,%ebp
jae    1130 <pascal+0x20>
xor    %eax,%eax
mov    %ebx,%r14d
jmp    1155 <pascal+0x45>
mov    $0x1,%eax
add    %eax,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @pascal(i32 %0, i32 %1) {
%3 = icmp ugt i32 %1, %0
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = icmp eq i32 %1, 0
%6 = add i32 %1, -1
br label %7
7: ; preds = %4, %10
%8 = phi i32 [ %0, %4 ], [ %11, %10 ]
%9 = phi i32 [ 0, %4 ], [ %13, %10 ]
br i1 %5, label %15, label %10
10: ; preds = %7
%11 = add i32 %8, -1
%12 = tail call i32 @pascal(i32 %11, i32 %6)
%13 = add i32 %12, %9
%14 = icmp ult i32 %11, %1
br i1 %14, label %15, label %7
15: ; preds = %7, %10
%16 = phi i32 [ %13, %10 ], [ 0, %7 ]
%17 = phi i32 [ 0, %10 ], [ 1, %7 ]
%18 = add i32 %17, %16
br label %19
19: ; preds = %15, %2
%20 = phi i32 [ %18, %15 ], [ 0, %2 ]
ret i32 %20
}
/* Variables and functions */
int /*<<< orphan*/ s2swin(float, float, float, float, float, float);
void s2swin_(float *x1, float *x2, float *y1, float *y2, float *z1, float *z2) {
  s2swin(*x1, *x2, *y1, *y2, *z1, *z2);
}


x86 assembly (clang, -O0):
<s2swin_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm3
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm4
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm5
call   1030 <s2swin@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2swin_>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
movss  (%rdx),%xmm2
movss  (%rcx),%xmm3
movss  (%r8),%xmm4
movss  (%r9),%xmm5
jmp    1030 <s2swin@plt>

LLVM IR (-O0):
define void @s2swin_(float* %0, float* %1, float* %2, float* %3, float* %4, float* %5) {
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
store float* %0, float** %7
store float* %1, float** %8
store float* %2, float** %9
store float* %3, float** %10
store float* %4, float** %11
store float* %5, float** %12
%13 = load float*, float** %7
%14 = load float, float* %13
%15 = load float*, float** %8
%16 = load float, float* %15
%17 = load float*, float** %9
%18 = load float, float* %17
%19 = load float*, float** %10
%20 = load float, float* %19
%21 = load float*, float** %11
%22 = load float, float* %21
%23 = load float*, float** %12
%24 = load float, float* %23
%25 = call i32 @s2swin(float %14, float %16, float %18, float %20, float %22, float %24)
ret void
}

LLVM IR (-O2):
define void @s2swin_(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* nocapture %3, float* nocapture %4, float* nocapture %5) {
%7 = load float, float* %0
%8 = load float, float* %1
%9 = load float, float* %2
%10 = load float, float* %3
%11 = load float, float* %4
%12 = load float, float* %5
%13 = tail call i32 @s2swin(float %7, float %8, float %9, float %10, float %11, float %12)
ret void
}
h(a, b, c) char *b;
{}


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @h(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* %4
ret i32 %8
}

LLVM IR (-O2):
define i32 @h(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 undef
}
/* Variables and functions */
int second_smallest(int *, int);
int test_negative_numbers() {
  int input[] = {-10, 23, -99, -125, 1};
  return second_smallest(input, 5) == -99;
}


x86 assembly (clang, -O0):
<test_negative_numbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <second_smallest@plt>
cmp    $0xffffff9d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_negative_numbers>:
sub    $0x18,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1030 <second_smallest@plt>
xor    %ecx,%ecx
cmp    $0xffffff9d,%eax
sete   %cl
mov    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.test_negative_numbers.input = [5 x i32] [i32 -10, i32 23, i32 -99, i32 -125, i32 1]
define i32 @test_negative_numbers() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @second_smallest(i32* %3, i32 5)
%5 = icmp eq i32 %4, -99
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@__const.test_negative_numbers.input = [5 x i32] [i32 -10, i32 23, i32 -99, i32 -125, i32 1]
define i32 @test_negative_numbers() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @second_smallest(i32* %3, i32 5)
%5 = icmp eq i32 %4, -99
%6 = zext i1 %5 to i32
ret i32 %6
}
void redfish_log_to_dev_null(void *log_ctx __attribute__((unused)),
                             const char *msg __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define void @redfish_log_to_dev_null(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int sapi_get_max_conn();
int /*<<< orphan*/ sapi_set_max_conn(int);
int set_so_max_conn() {
  int maxconn = 200;
  sapi_set_max_conn(maxconn);
  if (maxconn != sapi_get_max_conn()) {
    printf("failed to set\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<set_so_max_conn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xc8,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <sapi_set_max_conn@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <sapi_get_max_conn@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
je     1179 <set_so_max_conn+0x49>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1180 <set_so_max_conn+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_so_max_conn>:
push   %rbx
mov    $0xc8,%edi
call   1050 <sapi_set_max_conn@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <sapi_get_max_conn@plt>
cmp    $0xc8,%eax
je     115c <set_so_max_conn+0x2c>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@str = [14 x i8] c"failed to set\00"
define i32 @set_so_max_conn() {
%1 = tail call i32 @sapi_set_max_conn(i32 200)
%2 = tail call i32 (...) @sapi_get_max_conn()
%3 = icmp eq i32 %2, 200
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %0, %4
%7 = phi i32 [ -1, %4 ], [ 0, %0 ]
ret i32 %7
}
/* Variables and functions */
float floorf(float);
float test2f(float x) { return floorf(x); }


x86 assembly (clang, -O0):
<test2f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <floorf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2f>:
jmp    1030 <floorf@plt>

LLVM IR (-O0):
define float @test2f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @llvm.floor.f32(float %3)
ret float %4
}

LLVM IR (-O2):
define float @test2f(float %0) {
%2 = tail call float @llvm.floor.f32(float %0)
ret float %2
}
/* Variables and functions */
int _process_set_inetd_program(int /*<<< orphan*/, char *);
int libamg_process_stop_inetd_program(char *name) {
  return _process_set_inetd_program(0, name);
}


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

x86 assembly (clang, -O2):
<libamg_process_stop_inetd_program>:
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <_process_set_inetd_program@plt>

LLVM IR (-O0):
define i32 @libamg_process_stop_inetd_program(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @_process_set_inetd_program(i32 0, i8* %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @libamg_process_stop_inetd_program(i8* %0) {
%2 = tail call i32 @_process_set_inetd_program(i32 0, i8* %0)
ret i32 %2
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int clear_4d_facets(void) {
  int fail, *a, *b;
  double *c;
  fail = _ada_use_c2phc4c(585, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<clear_4d_facets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x249,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_4d_facets>:
mov    $0x249,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @clear_4d_facets() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca double*
%5 = load i32*, i32** %2
%6 = load i32*, i32** %3
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 585, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %1
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @clear_4d_facets() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 585, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ time(int /*<<< orphan*/);
unsigned time_seed() {
  time_t now = time(0);
  unsigned char *p = (unsigned char *)&now;
  unsigned seed = 0;
  size_t i;
  for (i = 0; i < sizeof now; i++)
    seed = seed * (256 + 2U) + p[i];
  return seed;
}


x86 assembly (clang, -O0):
<time_seed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x4,-0x20(%rbp)
jae    116d <time_seed+0x5d>
imul   $0x102,-0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1139 <time_seed+0x29>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_seed>:
push   %rax
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,%ecx
movzbl %al,%edx
movzbl %ah,%esi
shr    $0x10,%eax
shr    $0x18,%ecx
mov    %edx,%edi
shl    $0x8,%edi
lea    (%rdi,%rdx,2),%edx
add    %edx,%esi
mov    %esi,%edx
shl    $0x8,%edx
lea    (%rdx,%rsi,2),%edx
movzbl %al,%eax
add    %edx,%eax
mov    %eax,%edx
shl    $0x8,%edx
lea    (%rdx,%rax,2),%eax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @time_seed() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i64
%5 = call i32 @time(i32 0)
store i32 %5, i32* %1
%6 = bitcast i32* %1 to i8*
store i8* %6, i8** %2
store i32 0, i32* %3
store i64 0, i64* %4
br label %7
7: ; preds = %19, %0
%8 = load i64, i64* %4
%9 = icmp ult i64 %8, 4
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %3
%12 = mul i32 %11, 258
%13 = load i8*, i8** %2
%14 = load i64, i64* %4
%15 = getelementptr inbounds i8, i8* %13, i64 %14
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = add i32 %12, %17
store i32 %18, i32* %3
br label %19
19: ; preds = %10
%20 = load i64, i64* %4
%21 = add i64 %20, 1
store i64 %21, i64* %4
br label %7
22: ; preds = %7
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @time_seed() {
%1 = tail call i32 @time(i32 0)
%2 = lshr i32 %1, 8
%3 = lshr i32 %1, 16
%4 = lshr i32 %1, 24
%5 = and i32 %1, 255
%6 = mul nuw nsw i32 %5, 258
%7 = and i32 %2, 255
%8 = add nuw nsw i32 %6, %7
%9 = mul nuw nsw i32 %8, 258
%10 = and i32 %3, 255
%11 = add nuw nsw i32 %9, %10
%12 = mul i32 %11, 258
%13 = add i32 %12, %4
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("I'm a little driver, short and stout.");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"I'm a little driver, short and stout.\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"I'm a little driver, short and stout.\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ update_clock(int /*<<< orphan*/);
void user_task(void *fn) { update_clock(0); }


x86 assembly (clang, -O0):
<user_task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <update_clock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_task>:
xor    %edi,%edi
jmp    1030 <update_clock@plt>

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

LLVM IR (-O2):
define void @user_task(i8* nocapture readnone %0) {
%2 = tail call i32 @update_clock(i32 0)
ret void
}
/* Variables and functions */
char *capitalise(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main(void) {
  char string[] =
      "thIs iS MEANT to Be some Kind OF tEsT strinG?!.-+=#'; +-'#~@\n";
  printf("%s", capitalise(string, strlen(string)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x3e,%edx
call   1050 <memcpy@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%esi
call   1060 <capitalise@plt>
mov    %rax,%rsi
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movups 0xef2(%rip),%xmm0
movups %xmm0,0x2e(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <capitalise@plt>
lea    0xebe(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.string = [62 x i8] c"thIs iS MEANT to Be some Kind OF tEsT strinG?!.-+=#'; +-'#~@\0A\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [62 x i8]
store i32 0, i32* %1
%3 = bitcast [62 x i8]* %2 to i8*
%4 = getelementptr inbounds [62 x i8], [62 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [62 x i8], [62 x i8]* %2, i64 0, i64 0
%6 = call i32 @strlen(i8* %5)
%7 = call i8* @capitalise(i8* %4, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [62 x i8] c"thIs iS MEANT to Be some Kind OF tEsT strinG?!.-+=#'; +-'#~@\0A\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [62 x i8]
%2 = getelementptr inbounds [62 x i8], [62 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = call i8* @capitalise(i8* %2, i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
int test_imm_EAuint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xEA << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_EAuint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1005022347264
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void mdp4_dsi_video_wait4vsync(int cndx) {}


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

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

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

LLVM IR (-O2):
define void @mdp4_dsi_video_wait4vsync(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("set usb-Relay\n");
  printf("usage: ./set [digit] [digit]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"set usb-Relay\0A\00"
@.str.1 = [30 x i8] c"usage: ./set [digit] [digit]\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [14 x i8] c"set usb-Relay\00"
@str.2 = [29 x i8] c"usage: ./set [digit] [digit]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ free(double **);
int /*<<< orphan*/ freeDoubleVector(double *);
void freeDoubleMatrix(double **matrix, int rows) {
  int i;
  for (i = 0; i < rows; i++)
    freeDoubleVector(matrix[i]);
  free(matrix);
}


x86 assembly (clang, -O0):
<freeDoubleMatrix>:
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    1161 <freeDoubleMatrix+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <freeDoubleVector@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <freeDoubleMatrix+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeDoubleMatrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1152 <freeDoubleMatrix+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1040 <freeDoubleVector@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <freeDoubleMatrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @freeDoubleMatrix(double** %0, i32 %1) {
%3 = alloca double**
%4 = alloca i32
%5 = alloca i32
store double** %0, double*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load double**, double*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double*, double** %11, i64 %13
%15 = load double*, double** %14
%16 = call i32 @freeDoubleVector(double* %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = load double**, double*** %3
%22 = call i32 @free(double** %21)
ret void
}

LLVM IR (-O2):
define void @freeDoubleMatrix(double** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double*, double** %0, i64 %7
%9 = load double*, double** %8
%10 = tail call i32 @freeDoubleVector(double* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @free(double** %0)
ret void
}
int test_imm_77int16_reg(short val) {
  return ((val) & (-0x77 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_77int16_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, -119
%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_77int16_reg(i16 signext %0) {
%2 = and i16 %0, -119
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int stdin_read_line(char *, unsigned int);
int stdin_prompt_line(const char *prompt, char *str, unsigned int max_bytes) {
  printf("%s", prompt);
  return stdin_read_line(str, max_bytes);
}


x86 assembly (clang, -O0):
<stdin_prompt_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <stdin_read_line@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdin_prompt_line>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <stdin_read_line@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @stdin_prompt_line(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @stdin_read_line(i8* %1, i32 %2)
ret i32 %5
}
void cnrom_reset() {}


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

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

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

LLVM IR (-O2):
define void @cnrom_reset() {
ret void
}
/* Type definitions */
typedef scalar_t__ int8_t;
typedef scalar_t__ int64_t;

/* Variables and functions */
scalar_t__ INT8_MAX;
scalar_t__ INT8_MIN;
int QCBOR_Int64ToInt8(int64_t src, int8_t *dest) {
  if (src > INT8_MAX || src < INT8_MIN) {
    return -1;
  } else {
    *dest = (int8_t)src;
  }
  return 0;
}


x86 assembly (clang, -O0):
<QCBOR_Int64ToInt8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ec1(%rip),%rcx
cmp    (%rcx),%rax
jg     1134 <QCBOR_Int64ToInt8+0x34>
mov    -0x10(%rbp),%rax
mov    0x2ebd(%rip),%rcx
cmp    (%rcx),%rax
jge    1140 <QCBOR_Int64ToInt8+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    1152 <QCBOR_Int64ToInt8+0x52>
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<QCBOR_Int64ToInt8>:
mov    0x2ed1(%rip),%rcx
mov    $0xffffffff,%eax
cmp    %rdi,(%rcx)
jl     1122 <QCBOR_Int64ToInt8+0x22>
mov    0x2ed0(%rip),%rcx
cmp    %rdi,(%rcx)
jg     1122 <QCBOR_Int64ToInt8+0x22>
mov    %rdi,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
@INT8_MAX = global i64 0
@INT8_MIN = global i64 0
define i32 @QCBOR_Int64ToInt8(i64 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64*
store i64 %0, i64* %4
store i64* %1, i64** %5
%6 = load i64, i64* %4
%7 = load i64, i64* @INT8_MAX
%8 = icmp sgt i64 %6, %7
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i64, i64* %4
%11 = load i64, i64* @INT8_MIN
%12 = icmp slt i64 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %9, %2
store i32 -1, i32* %3
br label %18
14: ; preds = %9
%15 = load i64, i64* %4
%16 = load i64*, i64** %5
store i64 %15, i64* %16
br label %17
17: ; preds = %14
store i32 0, i32* %3
br label %18
18: ; preds = %17, %13
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@INT8_MAX = global i64 0
@INT8_MIN = global i64 0
define i32 @QCBOR_Int64ToInt8(i64 %0, i64* nocapture writeonly %1) {
%3 = load i64, i64* @INT8_MAX
%4 = icmp slt i64 %3, %0
%5 = load i64, i64* @INT8_MIN
%6 = icmp sgt i64 %5, %0
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %9, label %8
8: ; preds = %2
store i64 %0, i64* %1
br label %9
9: ; preds = %2, %8
%10 = phi i32 [ 0, %8 ], [ -1, %2 ]
ret i32 %10
}
void *threadFun2(void *arg) {
  while (1) {
    sleep(10);
    printf(" %s\n", arg);
  }
}


x86 assembly (clang, -O0):
<threadFun2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xa,%edi
mov    $0x0,%al
call   1040 <sleep@plt>
mov    -0x8(%rbp),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112c <threadFun2+0xc>

x86 assembly (clang, -O2):
<threadFun2>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
xchg   %ax,%ax
mov    $0xa,%edi
xor    %eax,%eax
call   1040 <sleep@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1130 <threadFun2+0x10>

LLVM IR (-O0):
@.str = [5 x i8] c" %s\0A\00"
define i8* @threadFun2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 10)
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %3
}

LLVM IR (-O2):
@.str = [5 x i8] c" %s\0A\00"
define i8* @threadFun2(i8* %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int main() {
  foo(-2147483648);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 -2147483648)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 -2147483648)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memmove(char *, char const *, int);
int strlen(char const *);
void strprep(char *Dest, const char *Src) {
  memmove(Dest + strlen(Src), Dest, strlen(Dest) + 1);
  memmove(Dest, Src, strlen(Src));
}


x86 assembly (clang, -O0):
<strprep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1040 <memmove@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <memmove@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strprep>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1030 <strlen@plt>
movslq %eax,%rbx
add    %r15,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <memmove@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <memmove@plt>

LLVM IR (-O0):
define void @strprep(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** %4
%7 = call i32 @strlen(i8* %6)
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8*, i8** %3
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
%13 = add nsw i32 %12, 1
%14 = call i32 @memmove(i8* %9, i8* %10, i32 %13)
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = load i8*, i8** %4
%18 = call i32 @strlen(i8* %17)
%19 = call i32 @memmove(i8* %15, i8* %16, i32 %18)
ret void
}

LLVM IR (-O2):
define void @strprep(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i32 @strlen(i8* %0)
%7 = add nsw i32 %6, 1
%8 = tail call i32 @memmove(i8* %5, i8* %0, i32 %7)
%9 = tail call i32 @strlen(i8* %1)
%10 = tail call i32 @memmove(i8* %0, i8* %1, i32 %9)
ret void
}