xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ neio_putc(char);
int neio_putd(int);
int neio_puti(int d) {
  if (d < 0) {
    d = -d;
    ((void)(neio_putc('-')));
  }
  return neio_putd(d);
}


x86 assembly (clang, -O0):
<neio_puti>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1147 <neio_puti+0x27>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x2d,%edi
call   1030 <neio_putc@plt>
mov    -0x4(%rbp),%edi
call   1040 <neio_putd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neio_puti>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
jns    1133 <neio_puti+0x13>
neg    %ebx
mov    $0x2d,%edi
call   1030 <neio_putc@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <neio_putd@plt>

LLVM IR (-O0):
define i32 @neio_puti(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
store i32 %7, i32* %2
%8 = call i64 @neio_putc(i8 signext 45)
br label %9
9: ; preds = %5, %1
%10 = load i32, i32* %2
%11 = call i32 @neio_putd(i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @neio_puti(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = sub nsw i32 0, %0
%5 = tail call i64 @neio_putc(i8 signext 45)
br label %6
6: ; preds = %3, %1
%7 = phi i32 [ %4, %3 ], [ %0, %1 ]
%8 = tail call i32 @neio_putd(i32 %7)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, char const);
bool cutils_cdar_DynamicArray_signed_char_format(const signed char *i, char **b,
                                                 size_t *s) {
  snprintf(*b, *s, "%c", *i);
  return true;
}


x86 assembly (clang, -O0):
<cutils_cdar_DynamicArray_signed_char_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rax
lea    0xec3(%rip),%rdx
movsbl (%rax),%ecx
call   1030 <snprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cutils_cdar_DynamicArray_signed_char_format>:
push   %rax
mov    (%rsi),%rax
mov    (%rdx),%rsi
movsbl (%rdi),%ecx
lea    0xedf(%rip),%rdx
mov    %rax,%rdi
call   1030 <snprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @cutils_cdar_DynamicArray_signed_char_format(i8* nocapture %0, i8** nocapture %1, i64* nocapture %2) {
%4 = load i8*, i8** %1
%5 = load i64, i64* %2
%6 = load i8, i8* %0
%7 = tail call i32 @snprintf(i8* %4, i64 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %6)
ret i32 1
}
/* Type definitions */
struct widget {
  int dummy;
};
struct view {
  int dummy;
};

/* Variables and functions */
struct widget *createwidget(struct view *);
int /*<<< orphan*/ widget_area_init(struct widget *, char *, char *, int, int,
                                    int, int);
void pool_create_area(struct view *view, char *id, char *in, int x, int y,
                      int w, int h) {
  struct widget *widget = createwidget(view);
  widget_area_init(widget, id, in, x, y, w, h);
}


x86 assembly (clang, -O0):
<pool_create_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <createwidget@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <widget_area_init@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pool_create_area>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %rdx,%rbp
mov    %rsi,%rbx
call   1030 <createwidget@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <widget_area_init@plt>

LLVM IR (-O0):
%struct.view = type { i32 }
%struct.widget = type { i32 }
define void @pool_create_area(%struct.view* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca %struct.view*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca %struct.widget*
store %struct.view* %0, %struct.view** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%16 = load %struct.view*, %struct.view** %8
%17 = call %struct.widget* @createwidget(%struct.view* %16)
store %struct.widget* %17, %struct.widget** %15
%18 = load %struct.widget*, %struct.widget** %15
%19 = load i8*, i8** %9
%20 = load i8*, i8** %10
%21 = load i32, i32* %11
%22 = load i32, i32* %12
%23 = load i32, i32* %13
%24 = load i32, i32* %14
%25 = call i32 @widget_area_init(%struct.widget* %18, i8* %19, i8* %20, i32 %21, i32 %22, i32 %23, i32 %24)
ret void
}

LLVM IR (-O2):
%struct.view = type { i32 }
%struct.widget = type { i32 }
define void @pool_create_area(%struct.view* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call %struct.widget* @createwidget(%struct.view* %0)
%9 = tail call i32 @widget_area_init(%struct.widget* %8, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6)
ret void
}
int max(int x, int y) { return ((x) > (y) ? (x) : (y)); }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <max+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t adts_get_channels(const uint8_t *p_adts) {
  return ((p_adts[2] & 0x01) << 2) | (p_adts[3] >> 6);
}


x86 assembly (clang, -O0):
<adts_get_channels>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
and    $0x1,%eax
shl    $0x2,%eax
mov    -0x8(%rbp),%rcx
mov    0xc(%rcx),%ecx
sar    $0x6,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adts_get_channels>:
mov    0x8(%rdi),%ecx
mov    0xc(%rdi),%eax
shl    $0x2,%ecx
and    $0x4,%ecx
sar    $0x6,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @adts_get_channels(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = shl i32 %3, 2
%5 = and i32 %4, 4
%6 = getelementptr inbounds i32, i32* %0, i64 3
%7 = load i32, i32* %6
%8 = ashr i32 %7, 6
%9 = or i32 %5, %8
ret i32 %9
}
/* Variables and functions */
char *getenv(char const *);
scalar_t__ issetugid();
char *secure_getenv(const char *name) {
  if (issetugid())
    return NULL;
  return getenv(name);
}


x86 assembly (clang, -O0):
<secure_getenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <issetugid@plt>
cmp    $0x0,%rax
je     114a <secure_getenv+0x2a>
movq   $0x0,-0x8(%rbp)
jmp    1157 <secure_getenv+0x37>
mov    -0x10(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<secure_getenv>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <issetugid@plt>
test   %rax,%rax
je     1134 <secure_getenv+0x14>
xor    %eax,%eax
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <getenv@plt>

LLVM IR (-O0):
define i8* @secure_getenv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i64 (...) @issetugid()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* null, i8** %2
br label %10
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i8* @getenv(i8* %8)
store i8* %9, i8** %2
br label %10
10: ; preds = %7, %6
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
define i8* @secure_getenv(i8* nocapture %0) {
%2 = tail call i64 (...) @issetugid()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i8* @getenv(i8* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i8* [ %5, %4 ], [ null, %1 ]
ret i8* %7
}
/* Variables and functions */
int count_array(char **array) {
  int i = 0;
  int arguments = 0;
  while (array[i] != NULL) {
    arguments++;
    i++;
  }
  return arguments;
}


x86 assembly (clang, -O0):
<count_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1140 <count_array+0x40>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <count_array+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_array>:
cmpq   $0x0,(%rdi)
je     111d <count_array+0x1d>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <count_array+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @count_array(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %6, %4 ], [ 0, %1 ]
%6 = add nuw nsw i64 %5, 1
%7 = getelementptr inbounds i8*, i8** %0, i64 %6
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %6 to i32
br label %12
12: ; preds = %10, %1
%13 = phi i32 [ 0, %1 ], [ %11, %10 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: remsync -sxv tree [state-file]\n");
  fprintf(stderr, "       remsync -duxvD tree [state-file [diff-file]]\n");
  fprintf(stderr, "       remsync [-xv] tree [diff-file]\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"Usage: remsync -sxv tree [state-file]\0A\00"
@.str.1 = [53 x i8] c" remsync -duxvD tree [state-file [diff-file]]\0A\00"
@.str.2 = [39 x i8] c" remsync [-xv] tree [diff-file]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Usage: remsync -sxv tree [state-file]\0A\00"
@.str.1 = [53 x i8] c" remsync -duxvD tree [state-file [diff-file]]\0A\00"
@.str.2 = [39 x i8] c" remsync [-xv] tree [diff-file]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ i2cWriteRegister(int, int, int);
void turnOnBacklight() { i2cWriteRegister(3, 0x22, 0x2A); }


x86 assembly (clang, -O0):
<turnOnBacklight>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
mov    $0x22,%esi
mov    $0x2a,%edx
call   1030 <i2cWriteRegister@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<turnOnBacklight>:
mov    $0x3,%edi
mov    $0x22,%esi
mov    $0x2a,%edx
jmp    1030 <i2cWriteRegister@plt>

LLVM IR (-O0):
define void @turnOnBacklight() {
%1 = call i32 @i2cWriteRegister(i32 3, i32 34, i32 42)
ret void
}

LLVM IR (-O2):
define void @turnOnBacklight() {
%1 = tail call i32 @i2cWriteRegister(i32 3, i32 34, i32 42)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fnc_exit() { exit(0); }


x86 assembly (clang, -O0):
<fnc_exit>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<fnc_exit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i32 @fnc_exit() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @fnc_exit() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int rand();
int randint(int from, int to) { return from + (rand() % (to - from + 1)); }


x86 assembly (clang, -O0):
<randint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randint>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @randint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 (...) @rand()
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = add nsw i32 %9, 1
%11 = srem i32 %6, %10
%12 = add nsw i32 %5, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @randint(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
void kill_myself() {
  pid_t pid;
  pid = getpid();
  kill(pid, SIGTERM);
}


x86 assembly (clang, -O0):
<kill_myself>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill_myself>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    0x2eb9(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
pop    %rax
jmp    1040 <kill@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
define void @kill_myself() {
%1 = alloca i32
%2 = call i32 (...) @getpid()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = load i32, i32* @SIGTERM
%5 = call i32 @kill(i32 %3, i32 %4)
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
define void @kill_myself() {
%1 = tail call i32 (...) @getpid()
%2 = load i32, i32* @SIGTERM
%3 = tail call i32 @kill(i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void freeseq_ann(char **seqc0a, char **seqc1a) {
  if (*seqc0a != NULL) {
    free(*seqc0a);
    *seqc0a = *seqc1a = NULL;
  }
}


x86 assembly (clang, -O0):
<freeseq_ann>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1150 <freeseq_ann+0x40>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeseq_ann>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1135 <freeseq_ann+0x25>
mov    %rsi,%r14
call   1030 <free@plt>
movq   $0x0,(%r14)
movq   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @freeseq_ann(i8** nocapture %0, i8** nocapture writeonly %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @free(i8* %3)
store i8* null, i8** %1
store i8* null, i8** %0
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char const *argv[]) {
  int i;
  for (i = 1; i <= 1000; ++i) {
    printf("%d\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jg     1157 <main+0x47>
mov    -0x14(%rbp),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x3e9,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 1, %2 ], [ %6, %3 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 1001
br i1 %7, label %8, label %3
8: ; preds = %3
ret i32 0
}
/* Type definitions */
struct route {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int __fprint_route_fmt(int /*<<< orphan*/ *, struct route const *, char const *,
                       int);
int fprint_route_header(FILE *output, const struct route *r, const char *fmt) {
  return __fprint_route_fmt(output, r, fmt, 1);
}


x86 assembly (clang, -O0):
<fprint_route_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x1,%ecx
call   1030 <__fprint_route_fmt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_route_header>:
mov    $0x1,%ecx
jmp    1030 <__fprint_route_fmt@plt>

LLVM IR (-O0):
%struct.route = type { i32 }
define i32 @fprint_route_header(i32* %0, %struct.route* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca %struct.route*
%6 = alloca i8*
store i32* %0, i32** %4
store %struct.route* %1, %struct.route** %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = load %struct.route*, %struct.route** %5
%9 = load i8*, i8** %6
%10 = call i32 @__fprint_route_fmt(i32* %7, %struct.route* %8, i8* %9, i32 1)
ret i32 %10
}

LLVM IR (-O2):
%struct.route = type { i32 }
define i32 @fprint_route_header(i32* %0, %struct.route* %1, i8* %2) {
%4 = tail call i32 @__fprint_route_fmt(i32* %0, %struct.route* %1, i8* %2, i32 1)
ret i32 %4
}
/* Type definitions */
struct ether_header {
  int /*<<< orphan*/ ether_type;
};

/* Variables and functions */
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ jlog(int, char *, int /*<<< orphan*/);
void inet_print_ether_type(void *data) {
  struct ether_header *hd;
  hd = data;
  jlog(0x08, "inet]> ether type: %x", htons(hd->ether_type));
}


x86 assembly (clang, -O0):
<inet_print_ether_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <htons@plt>
mov    %eax,%edx
mov    $0x8,%edi
lea    0xeb3(%rip),%rsi
call   1040 <jlog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_print_ether_type>:
push   %rax
mov    (%rdi),%edi
call   1030 <htons@plt>
lea    0xed1(%rip),%rsi
mov    $0x8,%edi
mov    %eax,%edx
pop    %rax
jmp    1040 <jlog@plt>

LLVM IR (-O0):
%struct.ether_header = type { i32 }
@.str = [22 x i8] c"inet]> ether type: %x\00"
define void @inet_print_ether_type(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.ether_header*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.ether_header*
store %struct.ether_header* %5, %struct.ether_header** %3
%6 = load %struct.ether_header*, %struct.ether_header** %3
%7 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @htons(i32 %8)
%10 = call i32 @jlog(i32 8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"inet]> ether type: %x\00"
define void @inet_print_ether_type(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @htons(i32 %3)
%5 = tail call i32 @jlog(i32 8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
void put_setup_backend(struct setup_backend *backend) {}


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

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

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

LLVM IR (-O2):
%struct.setup_backend = type opaque
define void @put_setup_backend(%struct.setup_backend* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *);
void Asm_Stop(void) {
  Inst_Printf(".section", ".note.GNU-stack,\"\",@progbits");
}


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

x86 assembly (clang, -O2):
<Asm_Stop>:
lea    0xee9(%rip),%rdi
lea    0xeeb(%rip),%rsi
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c".section\00"
@.str.1 = [29 x i8] c".note.GNU-stack,\22\22,@progbits\00"
define void @Asm_Stop() {
%1 = call i32 @Inst_Printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c".section\00"
@.str.1 = [29 x i8] c".note.GNU-stack,\22\22,@progbits\00"
define void @Asm_Stop() {
%1 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct remove_args_info {
  int dummy;
};

/* Variables and functions */
int EXIT_SUCCESS;
int remove_cmdline_parser_required(struct remove_args_info *args_info,
                                   const char *prog_name) {
  (void)(args_info);
  (void)(prog_name);
  return EXIT_SUCCESS;
}


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

x86 assembly (clang, -O2):
<remove_cmdline_parser_required>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.remove_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @remove_cmdline_parser_required(%struct.remove_args_info* %0, i8* %1) {
%3 = alloca %struct.remove_args_info*
%4 = alloca i8*
store %struct.remove_args_info* %0, %struct.remove_args_info** %3
store i8* %1, i8** %4
%5 = load %struct.remove_args_info*, %struct.remove_args_info** %3
%6 = load i8*, i8** %4
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
%struct.remove_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @remove_cmdline_parser_required(%struct.remove_args_info* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
void INT_Excep_IRQ7(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_IRQ7() {
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *mymalloc(size_t size, char *file, int line) {
  if (file == file && line == line) {
  }
  return malloc(size);
}


x86 assembly (clang, -O0):
<mymalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1142 <mymalloc+0x32>
mov    -0x14(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1142 <mymalloc+0x32>
jmp    1142 <mymalloc+0x32>
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mymalloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @mymalloc(i64 %0, i8* nocapture readnone %1, i32 %2) {
%4 = tail call i8* @malloc(i64 %0)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ z_stream;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ inflateEnd(int /*<<< orphan*/ *);
void streaming_commons_free_z_stream_inflate(z_stream *stream) {
  inflateEnd(stream);
  free(stream);
}


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

x86 assembly (clang, -O2):
<streaming_commons_free_z_stream_inflate>:
push   %rbx
mov    %rdi,%rbx
call   1040 <inflateEnd@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @streaming_commons_free_z_stream_inflate(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @inflateEnd(i32* %3)
%5 = load i32*, i32** %2
%6 = call i32 @free(i32* %5)
ret void
}

LLVM IR (-O2):
define void @streaming_commons_free_z_stream_inflate(i32* %0) {
%2 = tail call i32 @inflateEnd(i32* %0)
%3 = tail call i32 @free(i32* %0)
ret void
}
void *pupk(const void *a) {
  typedef void *ptr_t;
  return *((const ptr_t *)a);
}


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

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

LLVM IR (-O0):
define i8* @pupk(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i8**
%5 = load i8*, i8** %4
ret i8* %5
}

LLVM IR (-O2):
define i8* @pupk(i8* nocapture %0) {
%2 = bitcast i8* %0 to i8**
%3 = load i8*, i8** %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ RTLD_LAZY;
void *dlopen(char *, int /*<<< orphan*/);
void *dlsym(void *, char *);
void *find_func_address(char *func, char *lib) {
  void *handle = dlopen(lib, RTLD_LAZY);
  if (handle) {
    return dlsym(handle, func);
  } else {
    return NULL;
  }
}


x86 assembly (clang, -O0):
<find_func_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
call   1030 <dlopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1167 <find_func_address+0x47>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <dlsym@plt>
mov    %rax,-0x8(%rbp)
jmp    116f <find_func_address+0x4f>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_func_address>:
push   %rbx
mov    %rsi,%rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%rcx
mov    (%rcx),%esi
mov    %rax,%rdi
call   1030 <dlopen@plt>
test   %rax,%rax
je     1149 <find_func_address+0x29>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <dlsym@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@RTLD_LAZY = global i32 0
define i8* @find_func_address(i8* %0, i8* %1) {
%3 = load i32, i32* @RTLD_LAZY
%4 = tail call i8* @dlopen(i8* %1, i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i8* @dlsym(i8* %4, i8* %0)
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ null, %2 ]
ret i8* %9
}
void foo(void) {
  _Atomic(int) i = 0;
  i *= 2;
  i /= 2;
  i += 2;
  i -= 2;
  i++;
  i--;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    %ecx,%ecx
lock cmpxchg %ecx,-0x4(%rbp)
sete   %cl
test   $0x1,%cl
mov    %eax,-0x8(%rbp)
jne    1131 <foo+0x31>
jmp    1111 <foo+0x11>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
mov    %eax,%ecx
add    %edx,%ecx
mov    %ecx,-0x10(%rbp)
sar    %ecx
lock cmpxchg %ecx,-0x4(%rbp)
sete   %cl
test   $0x1,%cl
mov    %eax,-0xc(%rbp)
jne    1161 <foo+0x61>
jmp    1137 <foo+0x37>
lock addl $0x2,-0x4(%rbp)
lock subl $0x2,-0x4(%rbp)
lock addl $0x1,-0x4(%rbp)
lock subl $0x1,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movl   $0x0,-0x4(%rsp)
mov    -0x4(%rsp),%eax
nopl   0x0(%rax)
lea    (%rax,%rax,1),%ecx
lock cmpxchg %ecx,-0x4(%rsp)
jne    1110 <foo+0x10>
mov    -0x4(%rsp),%eax
nop
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
lock cmpxchg %ecx,-0x4(%rsp)
jne    1120 <foo+0x20>
lock addl $0x2,-0x4(%rsp)
lock subl $0x2,-0x4(%rsp)
lock addl $0x1,-0x4(%rsp)
lock subl $0x1,-0x4(%rsp)
ret

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load atomic i32, i32* %1 seq_cst
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ %2, %0 ], [ %7, %3 ]
%5 = mul nsw i32 %4, 2
%6 = cmpxchg i32* %1, i32 %4, i32 %5 seq_cst seq_cst
%7 = extractvalue { i32, i1 } %6, 0
%8 = extractvalue { i32, i1 } %6, 1
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = load atomic i32, i32* %1 seq_cst
br label %11
11: ; preds = %11, %9
%12 = phi i32 [ %10, %9 ], [ %15, %11 ]
%13 = sdiv i32 %12, 2
%14 = cmpxchg i32* %1, i32 %12, i32 %13 seq_cst seq_cst
%15 = extractvalue { i32, i1 } %14, 0
%16 = extractvalue { i32, i1 } %14, 1
br i1 %16, label %17, label %11
17: ; preds = %11
%18 = atomicrmw add i32* %1, i32 2 seq_cst
%19 = add i32 %18, 2
%20 = atomicrmw sub i32* %1, i32 2 seq_cst
%21 = sub i32 %20, 2
%22 = atomicrmw add i32* %1, i32 1 seq_cst
%23 = atomicrmw sub i32* %1, i32 1 seq_cst
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = load atomic i32, i32* %1 seq_cst
br label %4
4: ; preds = %4, %0
%5 = phi i32 [ %3, %0 ], [ %8, %4 ]
%6 = shl nsw i32 %5, 1
%7 = cmpxchg i32* %1, i32 %5, i32 %6 seq_cst seq_cst
%8 = extractvalue { i32, i1 } %7, 0
%9 = extractvalue { i32, i1 } %7, 1
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = load atomic i32, i32* %1 seq_cst
br label %12
12: ; preds = %12, %10
%13 = phi i32 [ %11, %10 ], [ %16, %12 ]
%14 = sdiv i32 %13, 2
%15 = cmpxchg i32* %1, i32 %13, i32 %14 seq_cst seq_cst
%16 = extractvalue { i32, i1 } %15, 0
%17 = extractvalue { i32, i1 } %15, 1
br i1 %17, label %18, label %12
18: ; preds = %12
%19 = atomicrmw add i32* %1, i32 2 seq_cst
%20 = atomicrmw sub i32* %1, i32 2 seq_cst
%21 = atomicrmw add i32* %1, i32 1 seq_cst
%22 = atomicrmw sub i32* %1, i32 1 seq_cst
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
void hello(int a) {
  printf("hello world! de %d\n", a);
  fflush(stdout);
  sleep(5);
}


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x5,%edi
call   1050 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello>:
push   %rax
mov    %edi,%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x5,%edi
pop    %rax
jmp    1050 <sleep@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"hello world! de %d\0A\00"
@stdout = global i32 0
define void @hello(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
%7 = call i32 @sleep(i32 5)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"hello world! de %d\0A\00"
@stdout = global i32 0
define void @hello(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 @sleep(i32 5)
ret void
}
void f2() {
  printf("\n%s: \n", __func__);
  printf("lib call f2()\n");
}


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

x86 assembly (clang, -O2):
<f2>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed8(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"\0A%s: \0A\00"
@__func__.f2 = [3 x i8] c"f2\00"
@.str.1 = [15 x i8] c"lib call f2()\0A\00"
define void @f2() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__func__.f2, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\0A%s: \0A\00"
@__func__.f2 = [3 x i8] c"f2\00"
@str = [14 x i8] c"lib call f2()\00"
define void @f2() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__func__.f2, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int creat(char const *, int);
int mus_file_create(const char *arg) { return (creat((arg), (0666))); }


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

x86 assembly (clang, -O2):
<mus_file_create>:
mov    $0x1b6,%esi
jmp    1030 <creat@plt>

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

LLVM IR (-O2):
define i32 @mus_file_create(i8* %0) {
%2 = tail call i32 @creat(i8* %0, i32 438)
ret i32 %2
}
int test05(short *a, char *b, int c, int d) {
  if (*a & *b)
    return c;
  return d;
}


x86 assembly (clang, -O0):
<test05>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movswl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1136 <test05+0x36>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113c <test05+0x3c>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test05>:
mov    %edx,%eax
movswl (%rdi),%edx
movsbl (%rsi),%esi
test   %edx,%esi
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test05(i16* nocapture %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = load i16, i16* %0
%6 = sext i16 %5 to i32
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = and i32 %8, %6
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i32 %3, i32 %2
ret i32 %11
}
/* Variables and functions */
scalar_t__ bar();
int /*<<< orphan*/ baz(int);
void f() {
  if (bar())
    baz(1);
  else
    baz(2);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <bar@plt>
cmp    $0x0,%rax
je     1144 <f+0x24>
mov    $0x1,%edi
call   1030 <baz@plt>
jmp    114e <f+0x2e>
mov    $0x2,%edi
call   1030 <baz@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
xor    %eax,%eax
call   1040 <bar@plt>
cmp    $0x1,%rax
mov    $0x1,%edi
adc    $0x0,%edi
pop    %rax
jmp    1030 <baz@plt>

LLVM IR (-O0):
define void @f() {
%1 = call i64 (...) @bar()
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @baz(i32 1)
br label %7
5: ; preds = %0
%6 = call i32 @baz(i32 2)
br label %7
7: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
define void @f() {
%1 = tail call i64 (...) @bar()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i32 2, i32 1
%4 = tail call i32 @baz(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int main() {
  system("./frases");
  system("./talk");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"./frases\00"
@.str.1 = [7 x i8] c"./talk\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"./frases\00"
@.str.1 = [7 x i8] c"./talk\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int ferror(FILE *stream) {
  (void)stream;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @ferror(i32* nocapture readnone %0) {
ret i32 0
}
void PyDTrace_IMPORT_FIND_LOAD_DONE(const char *arg0, int arg1) {}


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

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

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

LLVM IR (-O2):
define void @PyDTrace_IMPORT_FIND_LOAD_DONE(i8* nocapture %0, i32 %1) {
ret void
}
int diff(int val) { return (val > 0) ? val : 0; }


x86 assembly (clang, -O0):
<diff>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111c <diff+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <diff+0x26>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <diff+0x26>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff>:
xor    %eax,%eax
test   %edi,%edi
cmovns %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @diff(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *mlan_config_get_line(int /*<<< orphan*/ *, char *, int, int *);
char *config_get_line(char *s, int size, FILE *stream, int *line, char **_pos) {
  *_pos = mlan_config_get_line(stream, s, size, line);
  return *_pos;
}


x86 assembly (clang, -O0):
<config_get_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1030 <mlan_config_get_line@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_get_line>:
push   %rbx
mov    %r8,%rbx
mov    %rdx,%rax
mov    %esi,%edx
mov    %rdi,%rsi
mov    %rax,%rdi
call   1030 <mlan_config_get_line@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define i8* @config_get_line(i8* %0, i32 %1, i32* %2, i32* %3, i8** %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8**
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i8** %4, i8*** %10
%11 = load i32*, i32** %8
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = load i32*, i32** %9
%15 = call i8* @mlan_config_get_line(i32* %11, i8* %12, i32 %13, i32* %14)
%16 = load i8**, i8*** %10
store i8* %15, i8** %16
%17 = load i8**, i8*** %10
%18 = load i8*, i8** %17
ret i8* %18
}

LLVM IR (-O2):
define i8* @config_get_line(i8* %0, i32 %1, i32* %2, i32* %3, i8** nocapture writeonly %4) {
%6 = tail call i8* @mlan_config_get_line(i32* %2, i8* %0, i32 %1, i32* %3)
store i8* %6, i8** %4
ret i8* %6
}