xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *progname) {
  fprintf(stderr,
          "Usage: %s [-n<thread count>] -s<needle> [-d<directory>]\n"
          "\n"
          "Recursively searches all files in directory for\n"
          "a specified pattern and reports them to stdout.\n"
          "The pattern cannot be empty string.\n"
          "\n"
          "If thread count is not specified, number of cores\n"
          "is used instead.\n"
          "If directory is not specified, . is used instead\n",
          progname);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [307 x i8] c"Usage: %s [-n<thread count>] -s<needle> [-d<directory>]\0A\0ARecursively searches all files in directory for\0Aa specified pattern and reports them to stdout.\0AThe pattern cannot be empty string.\0A\0AIf thread count is not specified, number of cores\0Ais used instead.\0AIf directory is not specified, . is used instead\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([307 x i8], [307 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [307 x i8] c"Usage: %s [-n<thread count>] -s<needle> [-d<directory>]\0A\0ARecursively searches all files in directory for\0Aa specified pattern and reports them to stdout.\0AThe pattern cannot be empty string.\0A\0AIf thread count is not specified, number of cores\0Ais used instead.\0AIf directory is not specified, . is used instead\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([307 x i8], [307 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ loadN(int /*<<< orphan*/ *, int, int);
uint64_t fromMemory2(uint8_t *mem) { return loadN(mem, 8, 8); }


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

x86 assembly (clang, -O2):
<fromMemory2>:
mov    $0x8,%esi
mov    $0x8,%edx
jmp    1030 <loadN@plt>

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

LLVM IR (-O2):
define i32 @fromMemory2(i32* %0) {
%2 = tail call i32 @loadN(i32* %0, i32 8, i32 8)
ret i32 %2
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;

/* Variables and functions */
int32_t divideInt32By10(int32_t dividend) {
  return (int32_t)(((int64_t)dividend * (int64_t)0xCCCD) >> 16) >> 3;
}


x86 assembly (clang, -O0):
<divideInt32By10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0xcccd,-0x4(%rbp),%eax
sar    $0x10,%eax
sar    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divideInt32By10>:
imul   $0xcccd,%edi,%eax
sar    $0x13,%eax
ret

LLVM IR (-O0):
define i32 @divideInt32By10(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 52429
%5 = ashr i32 %4, 16
%6 = ashr i32 %5, 3
ret i32 %6
}

LLVM IR (-O2):
define i32 @divideInt32By10(i32 %0) {
%2 = mul nsw i32 %0, 52429
%3 = ashr i32 %2, 19
ret i32 %3
}
/* Type definitions */
typedef int u_char;

/* Variables and functions */
scalar_t__ calloc(int, int);
u_char *unpack(u_char a) {
  u_char *result = (u_char *)calloc(2, sizeof(u_char));
  result[1] = a & 0x0f;
  result[0] = a & 0xf0;
  result[0] >>= 4;
  return result;
}


x86 assembly (clang, -O0):
<unpack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%ecx
and    $0xf0,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sar    $0x4,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpack>:
push   %rbx
mov    %edi,%ebx
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %ebx,%ecx
and    $0xf,%ecx
mov    %ecx,0x4(%rax)
shr    $0x4,%ebx
and    $0xf,%ebx
mov    %ebx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i32* @unpack(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i64 @calloc(i32 2, i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %3
%6 = load i32, i32* %2
%7 = and i32 %6, 15
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 1
store i32 %7, i32* %9
%10 = load i32, i32* %2
%11 = and i32 %10, 240
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 0
store i32 %11, i32* %13
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 0
%16 = load i32, i32* %15
%17 = ashr i32 %16, 4
store i32 %17, i32* %15
%18 = load i32*, i32** %3
ret i32* %18
}

LLVM IR (-O2):
define i32* @unpack(i32 %0) {
%2 = tail call i64 @calloc(i32 2, i32 4)
%3 = inttoptr i64 %2 to i32*
%4 = and i32 %0, 15
%5 = getelementptr inbounds i32, i32* %3, i64 1
store i32 %4, i32* %5
%6 = lshr i32 %0, 4
%7 = and i32 %6, 15
store i32 %7, i32* %3
ret i32* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void restorecolor() { printf("\33[m"); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[m\00"
define void @restorecolor() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[m\00"
define void @restorecolor() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int gethostname(char *, long);
int gethostname_c8_(char *hostname, long len_hostname) {
  int result;
  result = gethostname(hostname, len_hostname);
  return result;
}


x86 assembly (clang, -O0):
<gethostname_c8_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <gethostname@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gethostname_c8_>:
jmp    1030 <gethostname@plt>

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

LLVM IR (-O2):
define i32 @gethostname_c8_(i8* %0, i64 %1) {
%3 = tail call i32 @gethostname(i8* %0, i64 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ gethostname(char *, int);
char *iupStrGetMemory(int);
char *iupdrvGetComputerName(void) {
  char *str = iupStrGetMemory(50);
  gethostname(str, 50);
  return str;
}


x86 assembly (clang, -O0):
<iupdrvGetComputerName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x32,%edi
call   1030 <iupStrGetMemory@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x32,%esi
call   1040 <gethostname@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupdrvGetComputerName>:
push   %rbx
mov    $0x32,%edi
call   1030 <iupStrGetMemory@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x32,%esi
call   1040 <gethostname@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @iupdrvGetComputerName() {
%1 = alloca i8*
%2 = call i8* @iupStrGetMemory(i32 50)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @gethostname(i8* %3, i32 50)
%5 = load i8*, i8** %1
ret i8* %5
}

LLVM IR (-O2):
define i8* @iupdrvGetComputerName() {
%1 = tail call i8* @iupStrGetMemory(i32 50)
%2 = tail call i32 @gethostname(i8* %1, i32 50)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ hello_func();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("This is a test program\n");
  hello_func();
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"This is a test program\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @hello_func()
ret i32 0
}

LLVM IR (-O2):
@str = [23 x i8] c"This is a test program\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @hello_func()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void f(const char *input) {
  printf("%s\n", input);
  input = "goodbye 1";
  printf("%s\n", input);
  char buf[16] = "goodbye 1.1";
  input = buf;
  ((char *)(input))[0] = 'G';
  printf("%s\n", input);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    0xec2(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x47,(%rax)
mov    -0x8(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rsi
lea    0xee1(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
movaps 0xed3(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x47,(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [10 x i8] c"goodbye 1\00"
@__const.f.buf = [16 x i8] c"goodbye 1.1\00\00\00\00\00"
define void @f(i8* %0) {
%2 = alloca i8*
%3 = alloca [16 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = bitcast [16 x i8]* %3 to i8*
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
store i8* %9, i8** %2
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 71, i8* %11
%12 = load i8*, i8** %2
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [10 x i8] c"goodbye 1\00"
@__const.f.buf = [16 x i8] c"goodbye 1.1\00\00\00\00\00"
define void @f(i8* %0) {
%2 = alloca [16 x i8]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
store i8 71, i8* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}
/* Variables and functions */
unsigned int parity_check(unsigned int);
unsigned int build_flit(int flitType, unsigned int payload) {
  unsigned int flit = 0 | (payload << 1) | (flitType << 29);
  unsigned int parity = parity_check(flit);
  return flit | parity;
}


x86 assembly (clang, -O0):
<build_flit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
or     $0x0,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1d,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <parity_check@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_flit>:
push   %rbx
lea    (%rsi,%rsi,1),%ebx
shl    $0x1d,%edi
or     %edi,%ebx
mov    %ebx,%edi
call   1030 <parity_check@plt>
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @build_flit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = shl i32 %7, 1
%9 = or i32 0, %8
%10 = load i32, i32* %3
%11 = shl i32 %10, 29
%12 = or i32 %9, %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i32 @parity_check(i32 %13)
store i32 %14, i32* %6
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = or i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @build_flit(i32 %0, i32 %1) {
%3 = shl i32 %1, 1
%4 = shl i32 %0, 29
%5 = or i32 %3, %4
%6 = tail call i32 @parity_check(i32 %5)
%7 = or i32 %6, %5
ret i32 %7
}
/* Variables and functions */
double __ocml_lgamma_f64(double);
double lgamma(double x) { return __ocml_lgamma_f64(x); }


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

x86 assembly (clang, -O2):
<lgamma>:
jmp    1030 <__ocml_lgamma_f64@plt>

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

LLVM IR (-O2):
define double @lgamma(double %0) {
%2 = tail call double @__ocml_lgamma_f64(double %0)
ret double %2
}
/* Variables and functions */
int sqlSigned(char *);
char *strchr(char *, char);
int sqlSignedComma(char **pS) {
  char *s = *pS;
  char *e = strchr(s, ',');
  int ret;
  *e++ = 0;
  *pS = e;
  ret = sqlSigned(s);
  return ret;
}


x86 assembly (clang, -O0):
<sqlSignedComma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <sqlSigned@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlSignedComma>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%r14
mov    %r14,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
movb   $0x0,(%rax)
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <sqlSigned@plt>

LLVM IR (-O0):
define i32 @sqlSignedComma(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8** %0, i8*** %2
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %6
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i8* @strchr(i8* %8, i8 signext 44)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %4
store i8 0, i8* %10
%12 = load i8*, i8** %4
%13 = load i8**, i8*** %2
store i8* %12, i8** %13
%14 = load i8*, i8** %3
%15 = call i32 @sqlSigned(i8* %14)
store i32 %15, i32* %5
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
define i32 @sqlSignedComma(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 44)
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8 0, i8* %3
store i8* %4, i8** %0
%5 = tail call i32 @sqlSigned(i8* %2)
ret i32 %5
}
char *datatype_select(void) {
  return "datatype,units,aggregation_sum_yn,bar_graph_yn,scale_graph_to_zero_"
         "yn,set_negative_values_to_zero_yn,calibrated_yn";
}


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

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

LLVM IR (-O0):
@.str = [115 x i8] c"datatype,units,aggregation_sum_yn,bar_graph_yn,scale_graph_to_zero_yn,set_negative_values_to_zero_yn,calibrated_yn\00"
define i8* @datatype_select() {
ret i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [115 x i8] c"datatype,units,aggregation_sum_yn,bar_graph_yn,scale_graph_to_zero_yn,set_negative_values_to_zero_yn,calibrated_yn\00"
define i8* @datatype_select() {
ret i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str, i64 0, i64 0)
}
long rangefix(long n) {
  if (n > 0)
    return n;
  return 0;
}


x86 assembly (clang, -O0):
<rangefix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    1120 <rangefix+0x20>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1128 <rangefix+0x28>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rangefix>:
xor    %eax,%eax
test   %rdi,%rdi
cmovns %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @rangefix(i64 %0) {
%2 = icmp sgt i64 %0, 0
%3 = select i1 %2, i64 %0, i64 0
ret i64 %3
}
void tdefault_terminal_ours(struct target_ops *self) {}


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

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

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

LLVM IR (-O2):
%struct.target_ops = type opaque
define void @tdefault_terminal_ours(%struct.target_ops* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void ncurs_cleanup() { endwin(); }


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

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

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

LLVM IR (-O2):
define void @ncurs_cleanup() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ firstTestCaseNoCycle();
int /*<<< orphan*/ secondTestCaseCycle();
int main(int argc, const char *argv[]) {
  firstTestCaseNoCycle();
  secondTestCaseCycle();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @firstTestCaseNoCycle()
%7 = call i32 (...) @secondTestCaseCycle()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @firstTestCaseNoCycle()
%4 = tail call i32 (...) @secondTestCaseCycle()
ret i32 0
}
/* Type definitions */
struct bwb_variable {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bwx_input(char *, char *);
int /*<<< orphan*/ str_btoc(char *, int /*<<< orphan*/);
struct bwb_variable *var_find(char *);
int /*<<< orphan*/ var_getsval(struct bwb_variable *);
int bwb_gets(char *buffer) {
  struct bwb_variable *v;
  char Buffer[4096 + 1];
  v = var_find("BWB.PROMPT$");
  str_btoc(Buffer, var_getsval(v));
  bwx_input(Buffer, buffer);
  return -1;
}


x86 assembly (clang, -O0):
<bwb_gets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xeaa(%rip),%rdi
call   1060 <var_find@plt>
mov    %rax,-0x10(%rbp)
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1028(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <var_getsval@plt>
mov    -0x1028(%rbp),%rdi
mov    %eax,%esi
call   1040 <str_btoc@plt>
lea    -0x1020(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <bwx_input@plt>
mov    $0xffffffff,%eax
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bwb_gets>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    %rdi,%r14
lea    0xeac(%rip),%rdi
call   1060 <var_find@plt>
mov    %rax,%rdi
call   1050 <var_getsval@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <str_btoc@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <bwx_input@plt>
mov    $0xffffffff,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.bwb_variable = type { i32 }
@.str = [12 x i8] c"BWB.PROMPT$\00"
define i32 @bwb_gets(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.bwb_variable*
%4 = alloca [4097 x i8]
store i8* %0, i8** %2
%5 = call %struct.bwb_variable* @var_find(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store %struct.bwb_variable* %5, %struct.bwb_variable** %3
%6 = getelementptr inbounds [4097 x i8], [4097 x i8]* %4, i64 0, i64 0
%7 = load %struct.bwb_variable*, %struct.bwb_variable** %3
%8 = call i32 @var_getsval(%struct.bwb_variable* %7)
%9 = call i32 @str_btoc(i8* %6, i32 %8)
%10 = getelementptr inbounds [4097 x i8], [4097 x i8]* %4, i64 0, i64 0
%11 = load i8*, i8** %2
%12 = call i32 @bwx_input(i8* %10, i8* %11)
ret i32 -1
}

LLVM IR (-O2):
%struct.bwb_variable = type { i32 }
@.str = [12 x i8] c"BWB.PROMPT$\00"
define i32 @bwb_gets(i8* %0) {
%2 = alloca [4097 x i8]
%3 = getelementptr inbounds [4097 x i8], [4097 x i8]* %2, i64 0, i64 0
%4 = tail call %struct.bwb_variable* @var_find(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @var_getsval(%struct.bwb_variable* %4)
%6 = call i32 @str_btoc(i8* %3, i32 %5)
%7 = call i32 @bwx_input(i8* %3, i8* %0)
ret i32 -1
}
double kmToCentimetres(double km) { return km * 100000.0; }


x86 assembly (clang, -O0):
<kmToCentimetres>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @kmToCentimetres(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.000000e+05
ret double %4
}

LLVM IR (-O2):
define double @kmToCentimetres(double %0) {
%2 = fmul double %0, 1.000000e+05
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_flist_new() {
  printf("NOT IMPLEMENTED:"
         "pa_flist_new"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"NOT IMPLEMENTED:pa_flist_new\0A\00"
define i32 @pa_flist_new() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [29 x i8] c"NOT IMPLEMENTED:pa_flist_new\00"
define i32 @pa_flist_new() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void RTPathStripTrailingSlash(void) {}


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

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

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

LLVM IR (-O2):
define void @RTPathStripTrailingSlash() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ check_all();
int /*<<< orphan*/ conditioninit();
void main(void) {
  conditioninit();
  check_all();
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <conditioninit@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <check_all@plt>

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @conditioninit()
%2 = tail call i32 (...) @check_all()
ret void
}
/* Variables and functions */
int read(int, char *, int);
int read_once(int fd, char *m_val) { return read(fd, m_val, 4096); }


x86 assembly (clang, -O0):
<read_once>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1000,%edx
call   1030 <read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_once>:
mov    $0x1000,%edx
jmp    1030 <read@plt>

LLVM IR (-O0):
define i32 @read_once(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = call i32 @read(i32 %5, i8* %6, i32 4096)
ret i32 %7
}

LLVM IR (-O2):
define i32 @read_once(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @read(i32 %0, i8* %1, i32 4096)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void msg_quitting() { printf("Story finished.\n"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"Story finished.\0A\00"
define void @msg_quitting() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"Story finished.\00"
define void @msg_quitting() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0xe3() {
  Assert_real((isalpha(227) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalpha.c",
              1140, ("isalpha should be 0 for 0xe3"));
}


x86 assembly (clang, -O0):
<t_isalpha_0xe3>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe3,%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x474,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0xe3>:
push   %rax
mov    $0xe3,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x474,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xe3\00"
define void @t_isalpha_0xe3() {
%1 = call i64 @isalpha(i32 227)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1140, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xe3\00"
define void @t_isalpha_0xe3() {
%1 = tail call i64 @isalpha(i32 227)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1140, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint16_t;

/* Variables and functions */
uint16_t direct_read16(volatile uint16_t *addr) { return *addr; }


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

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

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

LLVM IR (-O2):
define i32 @direct_read16(i32* %0) {
%2 = load volatile i32, i32* %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ foo(int, int);
int main(void) {
  foo(2, 3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x3,%esi
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 2, i32 3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 2, i32 3)
ret i32 0
}
void wifi_rsp_sme_ap_client_disconnect(
    const struct wifi_msg_sme_ap_client_disconnect_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.wifi_msg_sme_ap_client_disconnect_rsp_t = type opaque
define void @wifi_rsp_sme_ap_client_disconnect(%struct.wifi_msg_sme_ap_client_disconnect_rsp_t* nocapture %0) {
ret void
}
int TimeFixYear(int year) {
  if (year < 40)
    return (year + 2000);
  else if (year < 100)
    return (year + 1900);
  else
    return (year);
}


x86 assembly (clang, -O0):
<TimeFixYear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x28,-0x8(%rbp)
jge    1121 <TimeFixYear+0x21>
mov    -0x8(%rbp),%eax
add    $0x7d0,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <TimeFixYear+0x41>
cmpl   $0x64,-0x8(%rbp)
jge    113b <TimeFixYear+0x3b>
mov    -0x8(%rbp),%eax
add    $0x76c,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <TimeFixYear+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimeFixYear>:
lea    0x76c(%rdi),%eax
cmp    $0x64,%edi
cmovge %edi,%eax
lea    0x7d0(%rdi),%ecx
cmp    $0x28,%edi
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @TimeFixYear(i32 %0) {
%2 = icmp slt i32 %0, 40
%3 = add nsw i32 %0, 2000
%4 = icmp slt i32 %0, 100
%5 = add nsw i32 %0, 1900
%6 = select i1 %4, i32 %5, i32 %0
%7 = select i1 %2, i32 %3, i32 %6
ret i32 %7
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void write16(uint8_t *buf, uint16_t val) {
  buf[0] = val;
  buf[1] = val >> 8;
}


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

x86 assembly (clang, -O2):
<write16>:
mov    %esi,(%rdi)
sar    $0x8,%esi
mov    %esi,0x4(%rdi)
ret

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

LLVM IR (-O2):
define void @write16(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
%3 = ashr i32 %1, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %3, i32* %4
ret void
}
int test_imm_42int64_lowword_reg(long long val) {
  return ((val) & (0x42 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_42int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 66
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int tgaGetHeight(const unsigned char *buffer) {
  return (buffer[14] & 0xFF) | (buffer[15] & 0xFF) << 8;
}


x86 assembly (clang, -O0):
<tgaGetHeight>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0xe(%rax),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xf(%rcx),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tgaGetHeight>:
movzwl 0xe(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @tgaGetHeight(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 14
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = and i32 %6, 255
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 15
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = and i32 %11, 255
%13 = shl i32 %12, 8
%14 = or i32 %7, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @tgaGetHeight(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 14
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 15
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = or i32 %8, %4
ret i32 %9
}
/* Type definitions */
struct signature {
  int dummy;
};

/* Variables and functions */
int signature_equal(struct signature *, struct signature *);
int signature_ptr_equal(const void *x, const void *y) {
  return signature_equal((*(struct signature **)x), (*(struct signature **)y));
}


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

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

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

LLVM IR (-O2):
%struct.signature = type { i32 }
define i32 @signature_ptr_equal(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to %struct.signature**
%4 = load %struct.signature*, %struct.signature** %3
%5 = bitcast i8* %1 to %struct.signature**
%6 = load %struct.signature*, %struct.signature** %5
%7 = tail call i32 @signature_equal(%struct.signature* %4, %struct.signature* %6)
ret i32 %7
}
/* Variables and functions */
int Bcode(int);
int term_baud_ok(int baud) { return (Bcode(baud) != 0xFFFFFFFF) ? 1 : 0; }


x86 assembly (clang, -O0):
<term_baud_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <Bcode@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0xffffffff,%edx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<term_baud_ok>:
push   %rax
call   1030 <Bcode@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @term_baud_ok(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @Bcode(i32 %3)
%5 = icmp ne i32 %4, -1
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 1, i32 0
ret i32 %7
}

LLVM IR (-O2):
define i32 @term_baud_ok(i32 %0) {
%2 = tail call i32 @Bcode(i32 %0)
%3 = icmp ne i32 %2, -1
%4 = zext i1 %3 to i32
ret i32 %4
}
long long unsigned int factorial(int n) {
  if (n <= 1)
    return 1;
  return n * factorial(n - 1);
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jg     1132 <factorial+0x22>
movq   $0x1,-0x8(%rbp)
jmp    1154 <factorial+0x44>
movslq -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <factorial@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     1131 <factorial+0x31>
mov    %edi,%ecx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
imul   %rcx,%rax
lea    -0x1(%rcx),%rdx
cmp    $0x2,%rcx
mov    %rdx,%rcx
ja     1120 <factorial+0x20>
ret

LLVM IR (-O0):
define i64 @factorial(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 1, i64* %2
br label %14
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = call i64 @factorial(i32 %11)
%13 = mul i64 %9, %12
store i64 %13, i64* %2
br label %14
14: ; preds = %7, %6
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
define i64 @factorial(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = zext i32 %0 to i64
br label %5
5: ; preds = %3, %5
%6 = phi i64 [ %4, %3 ], [ %8, %5 ]
%7 = phi i64 [ 1, %3 ], [ %9, %5 ]
%8 = add nsw i64 %6, -1
%9 = mul i64 %7, %6
%10 = icmp ult i64 %6, 3
br i1 %10, label %11, label %5
11: ; preds = %5, %1
%12 = phi i64 [ 1, %1 ], [ %9, %5 ]
ret i64 %12
}
void ble_rsp_attclient_attribute_write(
    const struct ble_msg_attclient_attribute_write_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.ble_msg_attclient_attribute_write_rsp_t = type opaque
define void @ble_rsp_attclient_attribute_write(%struct.ble_msg_attclient_attribute_write_rsp_t* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, int);
void reportNewBadBlocks(char *mtdName, int known_bad_blocks,
                        int found_bad_blocks) {
  FILE *fp = fopen("/tmp/new_badblocks", "a");
  fprintf(fp, "%s:%d\n", mtdName, found_bad_blocks);
  fclose(fp);
}


x86 assembly (clang, -O0):
<reportNewBadBlocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xeb7(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%ecx
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reportNewBadBlocks>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbp
lea    0xebe(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1040 <fprintf@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"/tmp/new_badblocks\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [7 x i8] c"%s:%d\0A\00"
define void @reportNewBadBlocks(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
%8 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %7
%9 = load i32*, i32** %7
%10 = load i8*, i8** %4
%11 = load i32, i32* %6
%12 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %10, i32 %11)
%13 = load i32*, i32** %7
%14 = call i32 @fclose(i32* %13)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"/tmp/new_badblocks\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [7 x i8] c"%s:%d\0A\00"
define void @reportNewBadBlocks(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %2)
%6 = tail call i32 @fclose(i32* %4)
ret void
}
void foo542(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo542(i32 %0) {
ret void
}
/* Variables and functions */
int INT_MIN;
int bits_length(int i) {
  if ((i & INT_MIN) != 0) {
    return 32;
  }
  unsigned u = (unsigned)i;
  int length = 0;
  while (u >= (1 << length)) {
    length++;
  }
  return length;
}


x86 assembly (clang, -O0):
<bits_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ed7(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1128 <bits_length+0x28>
movl   $0x20,-0x4(%rbp)
jmp    1160 <bits_length+0x60>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jb     115a <bits_length+0x5a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1135 <bits_length+0x35>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits_length>:
mov    0x2ee1(%rip),%rax
mov    $0x20,%ecx
test   %edi,(%rax)
jne    112b <bits_length+0x2b>
mov    $0xffffffff,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ecx
mov    %edi,%eax
shr    %cl,%eax
test   %eax,%eax
jne    1120 <bits_length+0x20>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @bits_length(i32 %0) {
%2 = load i32, i32* @INT_MIN
%3 = and i32 %2, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ 0, %1 ]
%7 = lshr i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %5
10: ; preds = %5, %1
%11 = phi i32 [ 32, %1 ], [ %6, %5 ]
ret i32 %11
}