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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int sendto(int, void *, size_t, int, struct sockaddr *, int);
int i_sendto(int fd, void *buf, size_t len, int flags, struct sockaddr *addr,
             int size) {
  if (-1 == sendto(fd, buf, len, flags, addr, size)) {
    perror("i_sendto error");
    exit(1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<i_sendto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x2c(%rbp),%r9d
call   1030 <sendto@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    118e <i_sendto+0x5e>
lea    0xe81(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_sendto>:
push   %rax
call   1030 <sendto@plt>
cmp    $0xffffffff,%eax
je     113f <i_sendto+0xf>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeba(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [15 x i8] c"i_sendto error\00"
define i32 @i_sendto(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca %struct.sockaddr*
%12 = alloca i32
store i32 %0, i32* %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store %struct.sockaddr* %4, %struct.sockaddr** %11
store i32 %5, i32* %12
%13 = load i32, i32* %7
%14 = load i8*, i8** %8
%15 = load i64, i64* %9
%16 = load i32, i32* %10
%17 = load %struct.sockaddr*, %struct.sockaddr** %11
%18 = load i32, i32* %12
%19 = call i32 @sendto(i32 %13, i8* %14, i64 %15, i32 %16, %struct.sockaddr* %17, i32 %18)
%20 = icmp eq i32 -1, %19
br i1 %20, label %21, label %24
21: ; preds = %6
%22 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [15 x i8] c"i_sendto error\00"
define i32 @i_sendto(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32 %5) {
%7 = tail call i32 @sendto(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32 %5)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %6
ret i32 0
}
XAddToSaveSet() {}


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

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

LLVM IR (-O0):
define i32 @XAddToSaveSet() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XAddToSaveSet() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ n;

/* Variables and functions */
int /*<<< orphan*/ backtrackMSubset(int *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
void generateMSubsets(int m, int n) {
  int *A = (int *)malloc(n * sizeof(n));
  backtrackMSubset(A, 0, m, n);
  free(A);
}


x86 assembly (clang, -O0):
<generateMSubsets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
call   1040 <backtrackMSubset@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateMSubsets>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
lea    0x0(,%rbx,4),%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
call   1040 <backtrackMSubset@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @generateMSubsets(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 4
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %5
%12 = load i32*, i32** %5
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @backtrackMSubset(i32* %12, i32 0, i32 %13, i32 %14)
%16 = load i32*, i32** %5
%17 = call i32 @free(i32* %16)
ret void
}

LLVM IR (-O2):
define void @generateMSubsets(i32 %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @backtrackMSubset(i32* %5, i32 0, i32 %0, i32 %1)
%7 = tail call i32 @free(i32* %5)
ret void
}
int test_imm_4Aint64_lowword_reg(long long val) {
  return ((val) & (0x4A << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_4Aint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 74
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int *, int *);
void g(int x, int *out) { f(x, out, out); }


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

x86 assembly (clang, -O2):
<g>:
mov    %rsi,%rdx
jmp    1030 <f@plt>

LLVM IR (-O0):
define void @g(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 = load i32*, i32** %4
%8 = call i32 @f(i32 %5, i32* %6, i32* %7)
ret void
}

LLVM IR (-O2):
define void @g(i32 %0, i32* %1) {
%3 = tail call i32 @f(i32 %0, i32* %1, i32* %1)
ret void
}
rnn(int rny) { return (rny); }


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

x86 assembly (clang, -O2):
<rnn>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @rnn(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
uint32_t chpl_bitops_rotl_32(uint32_t x, uint32_t n) {
  assert(n < 32);
  return (x << n) | (x >> (-n & (32 - 1)));
}


x86 assembly (clang, -O0):
<chpl_bitops_rotl_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
and    $0x1f,%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chpl_bitops_rotl_32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x20,%esi
setl   %dil
call   1030 <assert@plt>
mov    %ebp,%eax
mov    %ebx,%ecx
shl    %cl,%eax
neg    %bl
mov    %ebx,%ecx
sar    %cl,%ebp
or     %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @chpl_bitops_rotl_32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 32
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = shl i32 %9, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = sub nsw i32 0, %13
%15 = and i32 %14, 31
%16 = ashr i32 %12, %15
%17 = or i32 %11, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @chpl_bitops_rotl_32(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 32
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = shl i32 %0, %1
%7 = sub nsw i32 0, %1
%8 = and i32 %7, 31
%9 = ashr i32 %0, %8
%10 = or i32 %9, %6
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void keyboard(unsigned char key, int x, int y) {
  (void)key;
  (void)x;
  (void)y;
  exit(0);
}


x86 assembly (clang, -O0):
<keyboard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
define void @keyboard(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @keyboard(i8 zeroext %0, i32 %1, i32 %2) {
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
size_t strlen(char *);
void truncate(char *string, int by) {
  size_t string_len = strlen(string);
  int index = string_len - by;
  string[index] = '\0';
}


x86 assembly (clang, -O0):
<truncate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<truncate>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
sub    %ebp,%eax
cltq
movb   $0x0,(%rbx,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @truncate(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = sub i64 %9, %11
%13 = trunc i64 %12 to i32
store i32 %13, i32* %6
%14 = load i8*, i8** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 0, i8* %17
ret void
}

LLVM IR (-O2):
define void @truncate(i8* nocapture %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = trunc i64 %3 to i32
%5 = sub i32 %4, %1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %7
ret void
}
double foo_d(double a, double b) { return -a * b; }


x86 assembly (clang, -O0):
<foo_d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @foo_d(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 = fneg double %5
%7 = load double, double* %4
%8 = fmul double %6, %7
ret double %8
}

LLVM IR (-O2):
define double @foo_d(double %0, double %1) {
%3 = fneg double %0
%4 = fmul double %3, %1
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ _pure_debug_printf(char *);
int /*<<< orphan*/ shm_unlink(char *);
void __attribute((destructor)) exit_test(void) {
  _pure_debug_printf("Unloading lib, done tracing.\n");
  shm_unlink("/puretrace_opts");
  return;
}


x86 assembly (clang, -O0):
<exit_test>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <_pure_debug_printf@plt>
lea    0xee7(%rip),%rdi
call   1040 <shm_unlink@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<exit_test>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <_pure_debug_printf@plt>
lea    0xeea(%rip),%rdi
pop    %rax
jmp    1040 <shm_unlink@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Unloading lib, done tracing.\0A\00"
@.str.1 = [16 x i8] c"/puretrace_opts\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @exit_test, i8* null }]
define void @exit_test() {
%1 = call i32 @_pure_debug_printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @shm_unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Unloading lib, done tracing.\0A\00"
@.str.1 = [16 x i8] c"/puretrace_opts\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @exit_test, i8* null }]
define void @exit_test() {
%1 = tail call i32 @_pure_debug_printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @shm_unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
int __attribute__((warn_unused_result)) addstr(char **dst, const char *str) {
  int len = strlen(str);
  if (dst != NULL) {
    memcpy(*dst, str, len);
    *dst += len;
  }
  return len;
}


x86 assembly (clang, -O0):
<addstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116d <addstr+0x4d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addstr>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
test   %rbx,%rbx
je     114c <addstr+0x2c>
mov    (%rbx),%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
movslq %ebp,%rax
add    %rax,(%rbx)
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @addstr(i8** %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp eq i8** %0, null
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = load i8*, i8** %0
%7 = tail call i32 @memcpy(i8* %6, i8* %1, i32 %3)
%8 = load i8*, i8** %0
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i8, i8* %8, i64 %9
store i8* %10, i8** %0
br label %11
11: ; preds = %5, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void borked_pipe(int signo) {
  printf("Connection with network has broken.");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"Connection with network has broken.\00"
define void @borked_pipe(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [36 x i8] c"Connection with network has broken.\00"
define void @borked_pipe(i32 %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ errprintf(char *, int, int, int);
int main(int argc, char *argv[]) {
  errprintf("testing ... %d %d %d\n", 1, 2, 3);
  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)
lea    0xed3(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <errprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <errprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"testing ... %d %d %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 @errprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i32 3)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"testing ... %d %d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @errprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ HplAtm128GeneralIOPinP__2__IO__toggle();
void LedsP__Led0__toggle(void) { HplAtm128GeneralIOPinP__2__IO__toggle(); }


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

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

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

LLVM IR (-O2):
define void @LedsP__Led0__toggle() {
%1 = tail call i32 (...) @HplAtm128GeneralIOPinP__2__IO__toggle()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wpa_cli_close_connection();
void wpa_cli_cleanup(void) { wpa_cli_close_connection(); }


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

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

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

LLVM IR (-O2):
define void @wpa_cli_cleanup() {
%1 = tail call i32 (...) @wpa_cli_close_connection()
ret void
}
void __attribute__((section(".after_vectors"), weak)) NMI_Handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<NMI_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <NMI_Handler+0x9>
jmp    1109 <NMI_Handler+0x9>

x86 assembly (clang, -O2):
<NMI_Handler>:
jmp    1100 <NMI_Handler>

LLVM IR (-O0):
define weak void @NMI_Handler() section ".after_vectors" {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define weak void @NMI_Handler() section ".after_vectors" {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int remainder(int x, int y) {
  int rem = x % y;
  if ((rem > 0 && y < 0) || (rem < 0 && y > 0))
    rem += y;
  return rem;
}


x86 assembly (clang, -O0):
<remainder>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1128 <remainder+0x28>
cmpl   $0x0,-0x8(%rbp)
jl     113c <remainder+0x3c>
cmpl   $0x0,-0xc(%rbp)
jge    1145 <remainder+0x45>
cmpl   $0x0,-0x8(%rbp)
jle    1145 <remainder+0x45>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<remainder>:
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
test   %esi,%esi
jns    110f <remainder+0xf>
test   %eax,%eax
jg     1117 <remainder+0x17>
test   %esi,%esi
jle    1119 <remainder+0x19>
test   %eax,%eax
jns    1119 <remainder+0x19>
add    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @remainder(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp sgt i32 %3, 0
%5 = icmp slt i32 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = icmp slt i32 %3, 0
%9 = icmp sgt i32 %1, 0
%10 = and i1 %9, %8
br i1 %10, label %11, label %13
11: ; preds = %7, %2
%12 = add nsw i32 %3, %1
br label %13
13: ; preds = %11, %7
%14 = phi i32 [ %12, %11 ], [ %3, %7 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ seekdir(int /*<<< orphan*/ *, int /*<<< orphan*/);
void __rewinddir(DIR *dirp) { seekdir(dirp, (off_t)0L); }


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

x86 assembly (clang, -O2):
<__rewinddir>:
xor    %esi,%esi
jmp    1030 <seekdir@plt>

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

LLVM IR (-O2):
define void @__rewinddir(i32* %0) {
%2 = tail call i32 @seekdir(i32* %0, i32 0)
ret void
}
void yy_1_InlineBlockContent(char *yytext, int yyleng) {
  ;
  ;
}


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

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

LLVM IR (-O0):
define void @yy_1_InlineBlockContent(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 @yy_1_InlineBlockContent(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int op_tcolor(int, int *);
int op_tcolor_gt4(int k, int *pos) {
  int i = *pos + 4;
  return op_tcolor(k, &i);
}


x86 assembly (clang, -O0):
<op_tcolor_gt4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1030 <op_tcolor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_tcolor_gt4>:
push   %rax
mov    (%rsi),%eax
add    $0x4,%eax
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <op_tcolor@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @op_tcolor_gt4(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 4
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = call i32 @op_tcolor(i32 %9, i32* %5)
ret i32 %10
}

LLVM IR (-O2):
define i32 @op_tcolor_gt4(i32 %0, i32* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 4
store i32 %6, i32* %3
%7 = call i32 @op_tcolor(i32 %0, i32* %3)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ usage(char const *);
void error_usage(const char *name, int err) {
  usage(name);
  exit(err);
}


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

x86 assembly (clang, -O2):
<error_usage>:
push   %rbx
mov    %esi,%ebx
call   1030 <usage@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @error_usage(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 = call i32 @usage(i8* %5)
%7 = load i32, i32* %4
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
define void @error_usage(i8* %0, i32 %1) {
%3 = tail call i32 @usage(i8* %0)
%4 = tail call i32 @exit(i32 %1)
unreachable
}
/* Type definitions */
struct dfont {
  int dummy;
};

/* Variables and functions */
struct dfont *dfont_create(int, int);
int /*<<< orphan*/ dfont_release(struct dfont *);
int /*<<< orphan*/ test(struct dfont *);
int main() {
  struct dfont *df = dfont_create(128, 128);
  test(df);
  dfont_release(df);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x80,%esi
mov    %esi,%edi
call   1030 <dfont_create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <test@plt>
mov    -0x10(%rbp),%rdi
call   1040 <dfont_release@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x80,%edi
mov    $0x80,%esi
call   1030 <dfont_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <test@plt>
mov    %rbx,%rdi
call   1040 <dfont_release@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.dfont = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.dfont*
store i32 0, i32* %1
%3 = call %struct.dfont* @dfont_create(i32 128, i32 128)
store %struct.dfont* %3, %struct.dfont** %2
%4 = load %struct.dfont*, %struct.dfont** %2
%5 = call i32 @test(%struct.dfont* %4)
%6 = load %struct.dfont*, %struct.dfont** %2
%7 = call i32 @dfont_release(%struct.dfont* %6)
ret i32 0
}

LLVM IR (-O2):
%struct.dfont = type { i32 }
define i32 @main() {
%1 = tail call %struct.dfont* @dfont_create(i32 128, i32 128)
%2 = tail call i32 @test(%struct.dfont* %1)
%3 = tail call i32 @dfont_release(%struct.dfont* %1)
ret i32 0
}
int dev_add_param(struct device_d *dev, char *name,
                  int (*set)(struct device_d *dev, struct param_d *p,
                             const char *val),
                  const char *(*get)(struct device_d *, struct param_d *p),
                  unsigned long flags) {
  return 0;
}


x86 assembly (clang, -O0):
<dev_add_param>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.device_d = type opaque
%struct.param_d = type opaque
%struct.param_d.0 = type opaque
define i32 @dev_add_param(%struct.device_d* nocapture readnone %0, i8* nocapture readnone %1, i32 (%struct.device_d*, %struct.param_d*, i8*)* nocapture readnone %2, i8* (%struct.device_d*, %struct.param_d.0*)* nocapture readnone %3, i64 %4) {
ret i32 0
}
void ASSERT_RTNL() {}


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

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

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

LLVM IR (-O2):
define void @ASSERT_RTNL() {
ret void
}
unsigned get_apic_id(unsigned long x) { return (x >> 24) & 0xFF; }


x86 assembly (clang, -O0):
<get_apic_id>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_apic_id>:
mov    %rdi,%rax
shr    $0x18,%eax
ret

LLVM IR (-O0):
define i32 @get_apic_id(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 24
%5 = and i64 %4, 255
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @get_apic_id(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i32 %2, 24
ret i32 %3
}
double f(x)
double x;
{ return x * x * x - 2 * x + 1; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xee8(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xeb4(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm0
subsd  %xmm0,%xmm1
addsd  0xee4(%rip),%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
%6 = load double, double* %2
%7 = load double, double* %2
%8 = fmul double 2.000000e+00, %7
%9 = fneg double %8
%10 = call double @llvm.fmuladd.f64(double %5, double %6, double %9)
%11 = fadd double %10, 1.000000e+00
ret double %11
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %0, -2.000000e+00
%4 = tail call double @llvm.fmuladd.f64(double %2, double %0, double %3)
%5 = fadd double %4, 1.000000e+00
ret double %5
}
int bitcount(unsigned int x) {
  int b;
  while (x) {
    ++b;
    x &= (x - 1);
  }
  return b;
}


x86 assembly (clang, -O0):
<bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112b <bitcount+0x2b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1107 <bitcount+0x7>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount>:
test   %edi,%edi
je     111c <bitcount+0x1c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%eax
lea    -0x1(%rdi),%ecx
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <bitcount+0x10>
ret

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

LLVM IR (-O2):
define i32 @bitcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ undef, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = add nsw i32 %4, 1
%7 = add i32 %5, -1
%8 = and i32 %7, %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ undef, %1 ], [ %6, %3 ]
ret i32 %11
}
void asn1_get_choice_selector(void) {}


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

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

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

LLVM IR (-O2):
define void @asn1_get_choice_selector() {
ret void
}
/* Variables and functions */
scalar_t__ ft_strcmp(char const *, char const *);
int ft_strequ(char const *s1, char const *s2) {
  if (s1 && s2) {
    if (ft_strcmp(s1, s2) == 0)
      return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<ft_strequ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115e <ft_strequ+0x4e>
cmpq   $0x0,-0x18(%rbp)
je     115e <ft_strequ+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <ft_strcmp@plt>
cmp    $0x0,%rax
jne    1159 <ft_strequ+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1165 <ft_strequ+0x55>
jmp    115e <ft_strequ+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strequ>:
test   %rdi,%rdi
je     112a <ft_strequ+0x1a>
test   %rsi,%rsi
je     112a <ft_strequ+0x1a>
push   %rax
call   1030 <ft_strcmp@plt>
test   %rax,%rax
lea    0x8(%rsp),%rsp
je     112d <ft_strequ+0x1d>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_strequ(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i64 @ft_strcmp(i8* %0, i8* %1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %6, %2
br label %10
10: ; preds = %6, %9
%11 = phi i32 [ 0, %9 ], [ 1, %6 ]
ret i32 %11
}
/* Variables and functions */
char *malloc(size_t);
char *memcpy(char *, char const *, size_t);
size_t strlen(char const *);
char *strdup(const char *s) {
  size_t l = strlen(s);
  char *d = malloc(l + 1);
  if (!d) {
    return NULL;
  }
  return memcpy(d, s, l + 1);
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1172 <strdup+0x42>
movq   $0x0,-0x8(%rbp)
jmp    118b <strdup+0x5b>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
call   1040 <memcpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
call   1050 <malloc@plt>
mov    %rax,%r15
test   %rax,%rax
je     1162 <strdup+0x32>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define noalias i8* @strdup(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %4, i8* align 1 %0, i64 %3, i1 false)
br label %7
7: ; preds = %1, %6
ret i8* %4
}
unsigned int ft_active_bits(int value) {
  unsigned int n;
  n = 0;
  while (value > 0) {
    if (value & 1 == 1)
      n++;
    value >>= 1;
  }
  return (n);
}


x86 assembly (clang, -O0):
<ft_active_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    113e <ft_active_bits+0x3e>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1130 <ft_active_bits+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <ft_active_bits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_active_bits>:
xor    %eax,%eax
test   %edi,%edi
jle    1120 <ft_active_bits+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <ft_active_bits+0x10>
ret

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

LLVM IR (-O2):
define i32 @ft_active_bits(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = add i32 %4, %6
%8 = lshr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
int main() {
  int a = 42;
  asm("" : "+r"(a));
  bar();
  asm("" : "+r"(a));
  if (a != 42)
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <bar@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x2a,-0x8(%rbp)
je     1158 <main+0x38>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2a,%ebx
xor    %eax,%eax
call   1040 <bar@plt>
cmp    $0x2a,%ebx
jne    1136 <main+0x16>
xor    %eax,%eax
pop    %rbx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 42, i32* %2
%3 = load i32, i32* %2
%4 = call i32 asm "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %3)
store i32 %4, i32* %2
%5 = call i32 (...) @bar()
%6 = load i32, i32* %2
%7 = call i32 asm "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %6)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 42
br i1 %9, label %10, label %11
10: ; preds = %0
unreachable
11: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 asm "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 42)
%2 = tail call i32 (...) @bar()
%3 = tail call i32 asm "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %1)
%4 = icmp eq i32 %3, 42
br i1 %4, label %6, label %5
5: ; preds = %0
tail call void @abort()
unreachable
6: ; preds = %0
ret i32 0
}
void device_del(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<device_del>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<device_del>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.device_del = [11 x i8] c"device_del\00"
define void @device_del() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.device_del, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.device_del = [11 x i8] c"device_del\00"
define void @device_del() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.device_del, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print(void) { printf("external symbol"); }


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"external symbol\00"
define void @print() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar_fd(char, int);
int ft_strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int);
void ft_putendl_fd(char const *s, int fd) {
  int l;
  l = ft_strlen(s);
  write(fd, s, l);
  ft_putchar_fd('\n', fd);
  return;
}


x86 assembly (clang, -O0):
<ft_putendl_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1030 <write@plt>
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1050 <ft_putchar_fd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putendl_fd>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <ft_strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0xa,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <ft_putchar_fd@plt>

LLVM IR (-O0):
define void @ft_putendl_fd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @ft_strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %4
%9 = load i8*, i8** %3
%10 = load i32, i32* %5
%11 = call i32 @write(i32 %8, i8* %9, i32 %10)
%12 = load i32, i32* %4
%13 = call i32 @ft_putchar_fd(i8 signext 10, i32 %12)
ret void
}

LLVM IR (-O2):
define void @ft_putendl_fd(i8* %0, i32 %1) {
%3 = tail call i32 @ft_strlen(i8* %0)
%4 = tail call i32 @write(i32 %1, i8* %0, i32 %3)
%5 = tail call i32 @ft_putchar_fd(i8 signext 10, i32 %1)
ret void
}
int equal(int *x, int *y, int n) {
  int i;
  for (i = 0; i < n; i++) {
    if (x[i] != y[i]) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<equal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    115d <equal+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     114a <equal+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1164 <equal+0x64>
jmp    114f <equal+0x4f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <equal+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal>:
mov    $0x1,%eax
test   %edx,%edx
jle    1121 <equal+0x21>
mov    %edx,%r8d
xor    %edx,%edx
xchg   %ax,%ax
mov    (%rdi,%rdx,4),%ecx
cmp    (%rsi,%rdx,4),%ecx
jne    1122 <equal+0x22>
add    $0x1,%rdx
cmp    %rdx,%r8
jne    1110 <equal+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @equal(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %1, i64 %10
%14 = load i32, i32* %13
%15 = icmp eq i32 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %18
}