xunge/DecIR huggingface dataset:
/* Type definitions */
struct rect {
  int dummy;
};

/* Variables and functions */
int cmp_x(struct rect *, struct rect *);
int cmp_y(struct rect *, struct rect *);
int cmp(struct rect *rect1, struct rect *rect2) {
  int ret = cmp_x(rect1, rect2);
  if (ret != 0) {
    return ret;
  }
  return cmp_y(rect1, rect2);
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <cmp_x@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1155 <cmp+0x35>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1165 <cmp+0x45>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <cmp_y@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <cmp_x@plt>
test   %eax,%eax
je     113b <cmp+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <cmp_y@plt>

LLVM IR (-O0):
%struct.rect = type { i32 }
define i32 @cmp(%struct.rect* %0, %struct.rect* %1) {
%3 = alloca i32
%4 = alloca %struct.rect*
%5 = alloca %struct.rect*
%6 = alloca i32
store %struct.rect* %0, %struct.rect** %4
store %struct.rect* %1, %struct.rect** %5
%7 = load %struct.rect*, %struct.rect** %4
%8 = load %struct.rect*, %struct.rect** %5
%9 = call i32 @cmp_x(%struct.rect* %7, %struct.rect* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* %6
store i32 %13, i32* %3
br label %18
14: ; preds = %2
%15 = load %struct.rect*, %struct.rect** %4
%16 = load %struct.rect*, %struct.rect** %5
%17 = call i32 @cmp_y(%struct.rect* %15, %struct.rect* %16)
store i32 %17, i32* %3
br label %18
18: ; preds = %14, %12
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.rect = type { i32 }
define i32 @cmp(%struct.rect* %0, %struct.rect* %1) {
%3 = tail call i32 @cmp_x(%struct.rect* %0, %struct.rect* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @cmp_y(%struct.rect* %0, %struct.rect* %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ %3, %2 ]
ret i32 %8
}
/* Variables and functions */
scalar_t__ floor(int);
int parent(int i) {
  int index = (i - 1) / 2;
  index = (int)floor(index);
  return index;
}


x86 assembly (clang, -O0):
<parent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <floor@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent>:
mov    %edi,%eax
add    $0xffffffff,%eax
shr    $0x1f,%eax
add    %eax,%edi
add    $0xffffffff,%edi
sar    %edi
jmp    1030 <floor@plt>

LLVM IR (-O0):
define i32 @parent(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 1
%6 = sdiv i32 %5, 2
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i64 @floor(i32 %7)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @parent(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = sdiv i32 %2, 2
%4 = tail call i64 @floor(i32 %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ sec_error(char *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ sec_errstr(int);
void sec_perror(const char *msg, int err) {
  sec_error("%s: %s", msg, sec_errstr(err));
}


x86 assembly (clang, -O0):
<sec_perror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <sec_errstr@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xeb4(%rip),%rdi
call   1040 <sec_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sec_perror>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <sec_errstr@plt>
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1040 <sec_error@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s: %s\00"
define void @sec_perror(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @sec_errstr(i32 %6)
%8 = call i32 @sec_error(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s: %s\00"
define void @sec_perror(i8* %0, i32 %1) {
%3 = tail call i32 @sec_errstr(i32 %1)
%4 = tail call i32 @sec_error(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main(void) {
  int *a = malloc(sizeof(int));
  free(a);
  a = NULL;
  int *b = malloc(sizeof(int));
  *b = 128;
  *a = 55;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x80,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x37,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32* @malloc(i32 4)
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = call i32 @free(i32* %4)
store i32* null, i32** %1
%6 = call i32* @malloc(i32 4)
store i32* %6, i32** %2
%7 = load i32*, i32** %2
store i32 128, i32* %7
%8 = load i32*, i32** %1
store i32 55, i32* %8
ret i32 0
}

LLVM IR (-O2):
/* Type definitions */
typedef int /*<<< orphan*/ td_thrhandle_t;

/* Variables and functions */
int _event_getmsg_helper(td_thrhandle_t const *handle, void *bkpt_addr) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @_event_getmsg_helper(i32* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
char *my_newString_doubleDec(double, int);
char *my_newString_double(double value) {
  return my_newString_doubleDec(value, -1);
}


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

x86 assembly (clang, -O2):
<my_newString_double>:
mov    $0xffffffff,%edi
jmp    1030 <my_newString_doubleDec@plt>

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

LLVM IR (-O2):
define i8* @my_newString_double(double %0) {
%2 = tail call i8* @my_newString_doubleDec(double %0, i32 -1)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ int80(int, int /*<<< orphan*/, unsigned char *, int,
                         int /*<<< orphan*/, int /*<<< orphan*/);
char getchar() {
  unsigned char c[2];
  int80(3, 0, c, 2, 0, 0);
  if (c[0] == 0)
    return -1;
  return c[0];
}


x86 assembly (clang, -O0):
<getchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x3(%rbp),%rdx
mov    $0x3,%edi
xor    %r9d,%r9d
mov    $0x2,%ecx
mov    %r9d,%esi
mov    %r9d,%r8d
call   1030 <int80@plt>
movzbl -0x3(%rbp),%eax
cmp    $0x0,%eax
jne    114a <getchar+0x3a>
movb   $0xff,-0x1(%rbp)
jmp    1150 <getchar+0x40>
mov    -0x3(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar>:
push   %rax
lea    0x6(%rsp),%rdx
mov    $0x3,%edi
xor    %esi,%esi
mov    $0x2,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <int80@plt>
mov    0x6(%rsp),%cl
cmp    $0x1,%cl
sbb    %eax,%eax
or     %cl,%al
pop    %rcx
ret

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

LLVM IR (-O2):
define signext i8 @getchar() {
%1 = alloca [2 x i8]
%2 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%3 = call i32 @int80(i32 3, i32 0, i8* %2, i32 2, i32 0, i32 0)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
%6 = select i1 %5, i8 -1, i8 %4
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0x39() {
  Assert_real((isalpha(57) == 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",
              290, ("isalpha should be 0 for 9"));
}


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

x86 assembly (clang, -O2):
<t_isalpha_0x39>:
push   %rax
mov    $0x39,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x122,%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 = [26 x i8] c"isalpha should be 0 for 9\00"
define void @t_isalpha_0x39() {
%1 = call i64 @isalpha(i32 57)
%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 290, i8* getelementptr inbounds ([26 x i8], [26 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 = [26 x i8] c"isalpha should be 0 for 9\00"
define void @t_isalpha_0x39() {
%1 = tail call i64 @isalpha(i32 57)
%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 290, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int gprc_get_sensors(int ADF_module, int sensors) {
  if (ADF_module == 0) {
    return sensors;
  }
  return 10;
}


x86 assembly (clang, -O0):
<gprc_get_sensors>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111f <gprc_get_sensors+0x1f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1126 <gprc_get_sensors+0x26>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gprc_get_sensors>:
test   %edi,%edi
mov    $0xa,%eax
cmove  %esi,%eax
ret

LLVM IR (-O0):
define i32 @gprc_get_sensors(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* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %5
store i32 %9, i32* %3
br label %11
10: ; preds = %2
store i32 10, i32* %3
br label %11
11: ; preds = %10, %8
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @gprc_get_sensors(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i32 %1, i32 10
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void nrerror(char error_text[]) { exit(1); }


x86 assembly (clang, -O0):
<nrerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<nrerror>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @nrerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @nrerror(i8* nocapture readnone %0) {
%2 = tail call i32 @exit(i32 1)
unreachable
}
void dummy_pointer(int visible __attribute__((unused)),
                   int x __attribute__((unused)), int y __attribute__((unused)),
                   const struct bogl_pointer *pointer __attribute__((unused)),
                   int colors[2] __attribute__((unused))) {}


x86 assembly (clang, -O0):
<dummy_pointer>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.bogl_pointer = type opaque
define void @dummy_pointer(i32 %0, i32 %1, i32 %2, %struct.bogl_pointer* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.bogl_pointer*
%10 = alloca i32*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store %struct.bogl_pointer* %3, %struct.bogl_pointer** %9
store i32* %4, i32** %10
ret void
}

LLVM IR (-O2):
%struct.bogl_pointer = type opaque
define void @dummy_pointer(i32 %0, i32 %1, i32 %2, %struct.bogl_pointer* nocapture %3, i32* nocapture %4) {
ret void
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ initGitApi();
int /*<<< orphan*/ killGitApi();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("add(1, 2) = %d\n", add(1, 2));
  initGitApi();
  killGitApi();
  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    $0x1,%edi
mov    $0x2,%esi
call   1030 <add@plt>
mov    %eax,%esi
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <initGitApi@plt>
mov    $0x0,%al
call   1060 <killGitApi@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <add@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <initGitApi@plt>
xor    %eax,%eax
call   1060 <killGitApi@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"add(1, 2) = %d\0A\00"
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 @add(i32 1, i32 2)
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (...) @initGitApi()
%9 = call i32 (...) @killGitApi()
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"add(1, 2) = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @add(i32 1, i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @initGitApi()
%6 = tail call i32 (...) @killGitApi()
ret i32 0
}
/* Variables and functions */
int check_clone_autoreap_ptrace(int /*<<< orphan*/);
int check_clone_autoreap_nosignals_ptrace(void) {
  return check_clone_autoreap_ptrace(0);
}


x86 assembly (clang, -O0):
<check_clone_autoreap_nosignals_ptrace>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <check_clone_autoreap_ptrace@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @check_clone_autoreap_nosignals_ptrace() {
%1 = call i32 @check_clone_autoreap_ptrace(i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @check_clone_autoreap_nosignals_ptrace() {
%1 = tail call i32 @check_clone_autoreap_ptrace(i32 0)
ret i32 %1
}
/* Type definitions */
typedef union supp {
  int dummy;
} supp;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  union supp *p;
  if (!1) {
    printf("Error %d\n", (int)1);
    exit(1);
  };
  {
    printf("Success\n");
    exit(0);
  };
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%union.supp = type { i32 }
@.str = [9 x i8] c"Success\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %union.supp*
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%union.supp = type { i32 }
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ setenv(char *, char *, int);
int /*<<< orphan*/ tzset();
int /*<<< orphan*/ unsetenv(char *);
void restore_tz(char *tz) {
  if (tz) {
    setenv("TZ", tz, 1);
    free(tz);
  } else {
    unsetenv("TZ");
  }
  tzset();
}


x86 assembly (clang, -O0):
<restore_tz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     117a <restore_tz+0x3a>
mov    -0x8(%rbp),%rsi
lea    0xe9e(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    1186 <restore_tz+0x46>
lea    0xe7f(%rip),%rdi
call   1060 <unsetenv@plt>
mov    $0x0,%al
call   1050 <tzset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restore_tz>:
push   %rbx
test   %rdi,%rdi
je     1167 <restore_tz+0x27>
mov    %rdi,%rbx
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    1173 <restore_tz+0x33>
lea    0xe92(%rip),%rdi
call   1060 <unsetenv@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <tzset@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"TZ\00"
define void @restore_tz(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @setenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0, i32 1)
%5 = tail call i32 @free(i8* %0)
br label %8
6: ; preds = %1
%7 = tail call i32 @unsetenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
%9 = tail call i32 (...) @tzset()
ret void
}
int rational_compare(long double *x, long double *y) {
  if ((*x) < (*y)) {
    return -1;
  } else if ((*x) == (*y)) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<rational_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
fldt   (%rax)
mov    -0x18(%rbp),%rax
fldt   (%rax)
fucomip %st(1),%st
fstp   %st(0)
jbe    1133 <rational_compare+0x33>
jmp    1127 <rational_compare+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <rational_compare+0x69>
mov    -0x10(%rbp),%rax
fldt   (%rax)
mov    -0x18(%rbp),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    1162 <rational_compare+0x62>
jp     1162 <rational_compare+0x62>
jmp    1156 <rational_compare+0x56>
movl   $0x0,-0x4(%rbp)
jmp    1169 <rational_compare+0x69>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rational_compare>:
fldt   (%rdi)
fldt   (%rsi)
fxch   %st(1)
fucomi %st(1),%st
setp   %al
setne  %cl
or     %al,%cl
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
movzbl %cl,%ecx
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @rational_compare(x86_fp80* %0, x86_fp80* %1) {
%3 = alloca i32
%4 = alloca x86_fp80*
%5 = alloca x86_fp80*
store x86_fp80* %0, x86_fp80** %4
store x86_fp80* %1, x86_fp80** %5
%6 = load x86_fp80*, x86_fp80** %4
%7 = load x86_fp80, x86_fp80* %6
%8 = load x86_fp80*, x86_fp80** %5
%9 = load x86_fp80, x86_fp80* %8
%10 = fcmp olt x86_fp80 %7, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %20
12: ; preds = %2
%13 = load x86_fp80*, x86_fp80** %4
%14 = load x86_fp80, x86_fp80* %13
%15 = load x86_fp80*, x86_fp80** %5
%16 = load x86_fp80, x86_fp80* %15
%17 = fcmp oeq x86_fp80 %14, %16
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 0, i32* %3
br label %20
19: ; preds = %12
store i32 1, i32* %3
br label %20
20: ; preds = %19, %18, %11
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @rational_compare(x86_fp80* nocapture %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %0
%4 = load x86_fp80, x86_fp80* %1
%5 = fcmp olt x86_fp80 %3, %4
%6 = fcmp une x86_fp80 %3, %4
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
int fun101() { return 101; }


x86 assembly (clang, -O0):
<fun101>:
push   %rbp
mov    %rsp,%rbp
mov    $0x65,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun101>:
mov    $0x65,%eax
ret

LLVM IR (-O0):
define i32 @fun101() {
ret i32 101
}

LLVM IR (-O2):
define i32 @fun101() {
ret i32 101
}
/* Variables and functions */
int /*<<< orphan*/ m68ki_read_imm_16();
int /*<<< orphan*/ m68ki_set_ccr(int /*<<< orphan*/);
void m68k_op_move_16_toc_i(void) { m68ki_set_ccr(m68ki_read_imm_16()); }


x86 assembly (clang, -O0):
<m68k_op_move_16_toc_i>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <m68ki_read_imm_16@plt>
mov    %eax,%edi
call   1030 <m68ki_set_ccr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_move_16_toc_i>:
push   %rax
xor    %eax,%eax
call   1040 <m68ki_read_imm_16@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <m68ki_set_ccr@plt>

LLVM IR (-O0):
define void @m68k_op_move_16_toc_i() {
%1 = call i32 (...) @m68ki_read_imm_16()
%2 = call i32 @m68ki_set_ccr(i32 %1)
ret void
}

LLVM IR (-O2):
define void @m68k_op_move_16_toc_i() {
%1 = tail call i32 (...) @m68ki_read_imm_16()
%2 = tail call i32 @m68ki_set_ccr(i32 %1)
ret void
}
/* Variables and functions */
int internal(double, double);
double bar(double a, double b) { return internal(a, b) * 10; }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <internal@plt>
imul   $0xa,%eax,%eax
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
call   1030 <internal@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @bar(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call i32 @internal(double %5, double %6)
%8 = mul nsw i32 %7, 10
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @bar(double %0, double %1) {
%3 = tail call i32 @internal(double %0, double %1)
%4 = mul nsw i32 %3, 10
%5 = sitofp i32 %4 to double
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
__attribute__((noreturn)) void show_help(const char *prog) {
  (void)fprintf(stderr,
                "Usage: %s [-d] [-u] [-s] [-n] [-p PREFIX] [-u URL] "
                "-l|-q|-c|-f|-i|-r PACKAGE\n",
                prog);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<show_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<show_help>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [78 x i8] c"Usage: %s [-d] [-u] [-s] [-n] [-p PREFIX] [-u URL] -l|-q|-c|-f|-i|-r PACKAGE\0A\00"
@EXIT_FAILURE = global i32 0
define void @show_help(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 ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [78 x i8] c"Usage: %s [-d] [-u] [-s] [-n] [-p PREFIX] [-u URL] -l|-q|-c|-f|-i|-r PACKAGE\0A\00"
@EXIT_FAILURE = global i32 0
define void @show_help(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ shm_unlink(char *);
void onexit(void) {
  if (shm_unlink("/statbar") < 0) {
    perror("unlinking shared mem");
  }
  printf("cleaned up\n");
}


x86 assembly (clang, -O0):
<onexit>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1050 <shm_unlink@plt>
cmp    $0x0,%rax
jge    1156 <onexit+0x26>
lea    0xeb8(%rip),%rdi
call   1040 <perror@plt>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<onexit>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <shm_unlink@plt>
test   %rax,%rax
js     114f <onexit+0x1f>
lea    0xed5(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xeb3(%rip),%rdi
call   1040 <perror@plt>
jmp    1142 <onexit+0x12>

LLVM IR (-O0):
@.str = [9 x i8] c"/statbar\00"
@.str.1 = [21 x i8] c"unlinking shared mem\00"
@.str.2 = [12 x i8] c"cleaned up\0A\00"
define void @onexit() {
%1 = call i64 @shm_unlink(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"/statbar\00"
@.str.1 = [21 x i8] c"unlinking shared mem\00"
@str = [11 x i8] c"cleaned up\00"
define void @onexit() {
%1 = tail call i64 @shm_unlink(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ pow(unsigned long, int);
scalar_t__ round(double);
unsigned long int cubicBrightness(long unsigned int x) {
  return (unsigned long int)round(0.0000153787005 * (double)pow(x, 3));
}


x86 assembly (clang, -O0):
<cubicBrightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm1
movsd  0xeb9(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <round@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cubicBrightness>:
push   %rax
mov    $0x3,%esi
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm0
mulsd  0xec8(%rip),%xmm0
pop    %rax
jmp    1040 <round@plt>

LLVM IR (-O0):
define i64 @cubicBrightness(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @pow(i64 %3, i32 3)
%5 = sitofp i64 %4 to double
%6 = fmul double 0x3EF0203040513E12, %5
%7 = call i64 @round(double %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @cubicBrightness(i64 %0) {
%2 = tail call i64 @pow(i64 %0, i32 3)
%3 = sitofp i64 %2 to double
%4 = fmul double %3, 0x3EF0203040513E12
%5 = tail call i64 @round(double %4)
ret i64 %5
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void badvpn_write_be8(uint8_t x, char *c_ptr) {
  uint8_t *ptr = (uint8_t *)c_ptr;
  ptr[0] = x >> 0;
}


x86 assembly (clang, -O0):
<badvpn_write_be8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
sar    $0x0,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<badvpn_write_be8>:
mov    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define void @badvpn_write_be8(i32 %0, i8* nocapture writeonly %1) {
%3 = bitcast i8* %1 to i32*
store i32 %0, i32* %3
ret void
}
int exact_square(int num) {
  int i, sqr;
  i = num;
  while (i != 0) {
    sqr = i * i;
    if (sqr == num) {
      return 1;
    }
    i--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1147 <exact_square+0x47>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1139 <exact_square+0x39>
movl   $0x1,-0x4(%rbp)
jmp    114e <exact_square+0x4e>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110d <exact_square+0xd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
xor    %eax,%eax
test   %edi,%edi
je     111e <exact_square+0x1e>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edx
imul   %ecx,%edx
cmp    %edi,%edx
je     111f <exact_square+0x1f>
add    $0xffffffff,%ecx
jne    1110 <exact_square+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @exact_square(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %5
3: ; preds = %5
%4 = icmp eq i32 %9, 0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ %0, %1 ]
%7 = mul nsw i32 %6, %6
%8 = icmp eq i32 %7, %0
%9 = add nsw i32 %6, -1
br i1 %8, label %10, label %3
10: ; preds = %5, %3, %1
%11 = phi i32 [ 0, %1 ], [ 0, %3 ], [ 1, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
void QEIIntEnable(unsigned long ulBase, unsigned long ulIntFlags) {
  DEBUG_ASSERT((ulBase == 0x4002C000) || (ulBase == 0x4002D000));
  (*((volatile unsigned long *)(ulBase + 0x00000020))) |= ulIntFlags;
}


x86 assembly (clang, -O0):
<QEIIntEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%al
cmpq   $0x4002c000,-0x8(%rbp)
40
mov    %al,-0x11(%rbp)
je     1141 <QEIIntEnable+0x31>
cmpq   $0x4002d000,-0x8(%rbp)
40
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x20(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIIntEnable>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdi,%rax
and    $0xffffffffffffefff,%rax
xor    %edi,%edi
cmp    $0x4002c000,%rax
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
or     %r14,0x20(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @QEIIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 1073922048
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, 1073926144
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ true, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @DEBUG_ASSERT(i32 %12)
%14 = load i64, i64* %4
%15 = load i64, i64* %3
%16 = add i64 %15, 32
%17 = inttoptr i64 %16 to i64*
%18 = load volatile i64, i64* %17
%19 = or i64 %18, %14
store volatile i64 %19, i64* %17
ret void
}

LLVM IR (-O2):
define void @QEIIntEnable(i64 %0, i64 %1) {
%3 = and i64 %0, -4097
%4 = icmp eq i64 %3, 1073922048
%5 = zext i1 %4 to i32
%6 = tail call i32 @DEBUG_ASSERT(i32 %5)
%7 = add i64 %0, 32
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %1
store volatile i64 %10, i64* %8
ret void
}
/* Variables and functions */
char getchar();
bool discardUnnecessaryInput() {
  int i;
  for (i = 0; getchar() != '\n'; i++) {
  }
  return (i > 0) ? true : false;
}


x86 assembly (clang, -O0):
<discardUnnecessaryInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1145 <discardUnnecessaryInput+0x35>
jmp    1137 <discardUnnecessaryInput+0x27>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <discardUnnecessaryInput+0xf>
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovg  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<discardUnnecessaryInput>:
push   %rbx
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
add    $0xffffffff,%ebx
cmp    $0xa,%al
jne    1120 <discardUnnecessaryInput+0x10>
xor    %eax,%eax
test   %ebx,%ebx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @discardUnnecessaryInput() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %7, %0
%3 = call signext i8 (...) @getchar()
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 10
br i1 %5, label %6, label %10
6: ; preds = %2
br label %7
7: ; preds = %6
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
br label %2
10: ; preds = %2
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
ret i32 %14
}

LLVM IR (-O2):
define i32 @discardUnnecessaryInput() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call signext i8 (...) @getchar()
%4 = icmp eq i8 %3, 10
%5 = add nuw nsw i32 %2, 1
br i1 %4, label %6, label %1
6: ; preds = %1
%7 = icmp ne i32 %2, 0
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stdout;
void on_success(int number) { fprintf(stdout, "word number: %d\n", number); }


x86 assembly (clang, -O0):
<on_success>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xed2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<on_success>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [17 x i8] c"word number: %d\0A\00"
define void @on_success(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stdout
%4 = load i32, i32* %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [17 x i8] c"word number: %d\0A\00"
define void @on_success(i32 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
char my_ctolower(char c) {
  if (c >= 'A' && c <= 'Z')
    return 'a' + (c - 'A');
  else
    return c;
}


x86 assembly (clang, -O0):
<my_ctolower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1136 <my_ctolower+0x36>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     1136 <my_ctolower+0x36>
movsbl -0x2(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %al,-0x1(%rbp)
jmp    113c <my_ctolower+0x3c>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_ctolower>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @my_ctolower(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %17
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 65
%15 = add nsw i32 97, %14
%16 = trunc i32 %15 to i8
store i8 %16, i8* %2
br label %19
17: ; preds = %7, %1
%18 = load i8, i8* %3
store i8 %18, i8* %2
br label %19
19: ; preds = %17, %11
%20 = load i8, i8* %2
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @my_ctolower(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sum_them_all(int, int, int, ...);
int main(void) {
  int sum;
  sum = sum_them_all(2, 98, 1024);
  printf("%d\n", sum);
  sum = sum_them_all(4, 98, 1024, 402, -1024);
  printf("%d\n", sum);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x62,%esi
mov    $0x400,%edx
mov    $0x0,%al
call   1030 <sum_them_all@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4,%edi
mov    $0x62,%esi
mov    $0x400,%edx
mov    $0x192,%ecx
mov    $0xfffffc00,%r8d
mov    $0x0,%al
call   1030 <sum_them_all@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2,%edi
mov    $0x62,%esi
mov    $0x400,%edx
xor    %eax,%eax
call   1030 <sum_them_all@plt>
lea    0xec2(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x4,%edi
mov    $0x62,%esi
mov    $0x400,%edx
mov    $0x192,%ecx
mov    $0xfffffc00,%r8d
xor    %eax,%eax
call   1030 <sum_them_all@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i32, i32, i32, ...) @sum_them_all(i32 2, i32 98, i32 1024)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 (i32, i32, i32, ...) @sum_them_all(i32 4, i32 98, i32 1024, i32 402, i32 -1024)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i32, i32, i32, ...) @sum_them_all(i32 2, i32 98, i32 1024)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (i32, i32, i32, ...) @sum_them_all(i32 4, i32 98, i32 1024, i32 402, i32 -1024)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Type definitions */
struct set {
  int dummy;
};

/* Variables and functions */
int set_add(struct set *, void *, scalar_t__);
scalar_t__ strlen(char *);
int set_add_string(struct set *t, char *s) {
  return set_add(t, (void *)s, strlen(s) + 1);
}


x86 assembly (clang, -O0):
<set_add_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
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    %rax,%rdx
add    $0x1,%rdx
call   1040 <set_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_add_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <set_add@plt>

LLVM IR (-O0):
%struct.set = type { i32 }
define i32 @set_add_string(%struct.set* %0, i8* %1) {
%3 = alloca %struct.set*
%4 = alloca i8*
store %struct.set* %0, %struct.set** %3
store i8* %1, i8** %4
%5 = load %struct.set*, %struct.set** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = add nsw i64 %8, 1
%10 = call i32 @set_add(%struct.set* %5, i8* %6, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.set = type { i32 }
define i32 @set_add_string(%struct.set* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = add nsw i64 %3, 1
%5 = tail call i32 @set_add(%struct.set* %0, i8* %1, i64 %4)
ret i32 %5
}
/* Variables and functions */
int abs(unsigned int);
int /*<<< orphan*/ printf(char *, int);
void scroll_down(unsigned int lines) { printf("\e[%dT", abs(lines)); }


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

x86 assembly (clang, -O2):
<scroll_down>:
mov    %edi,%esi
neg    %esi
cmovs  %edi,%esi
lea    0xee2(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dT\00"
define void @scroll_down(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int Demo_Decr(int n) {
  puts("DECR");
  return n - 1;
}


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

x86 assembly (clang, -O2):
<Demo_Decr>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
add    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"DECR\00"
define i32 @Demo_Decr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
@.str = [5 x i8] c"DECR\00"
define i32 @Demo_Decr(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = add nsw i32 %0, -1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *strrpl(char *, char *, char *);
int main(void) {
  char c[20] = "abcdef";
  printf("%s\n", c);
  printf("%s\n", strrpl(c, "c", "**"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xeaf(%rip),%rsi
lea    0xeaa(%rip),%rdx
call   1040 <strrpl@plt>
mov    %rax,%rsi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xed3(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xec2(%rip),%rsi
lea    0xebd(%rip),%rdx
mov    %rbx,%rdi
call   1040 <strrpl@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.c = [20 x i8] c"abcdef\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [2 x i8] c"c\00"
@.str.2 = [3 x i8] c"**\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
store i32 0, i32* %1
%3 = bitcast [20 x i8]* %2 to i8*
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = call i8* @strrpl(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.c = [20 x i8] c"abcdef\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [2 x i8] c"c\00"
@.str.2 = [3 x i8] c"**\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i8* @strrpl(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}