xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ DebugTrace(char *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void D2xx_CloseConfigFile(FILE *file) {
  fclose(file);
  DebugTrace("d2xx_table: Close configuration file - %s\n", strerror(errno));
}


x86 assembly (clang, -O0):
<D2xx_CloseConfigFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %eax,%esi
lea    0xea4(%rip),%rdi
call   1030 <DebugTrace@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<D2xx_CloseConfigFile>:
push   %rax
call   1040 <fclose@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeb5(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <DebugTrace@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"d2xx_table: Close configuration file - %s\0A\00"
@errno = global i32 0
define void @D2xx_CloseConfigFile(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fclose(i32* %3)
%5 = load i32, i32* @errno
%6 = call i32 @strerror(i32 %5)
%7 = call i32 @DebugTrace(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"d2xx_table: Close configuration file - %s\0A\00"
@errno = global i32 0
define void @D2xx_CloseConfigFile(i32* nocapture %0) {
%2 = tail call i32 @fclose(i32* %0)
%3 = load i32, i32* @errno
%4 = tail call i32 @strerror(i32 %3)
%5 = tail call i32 @DebugTrace(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Type definitions */
struct rlimit {
  scalar_t__ rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_NOFILE;
int getrlimit(int /*<<< orphan*/, struct rlimit *);
int maxfile() {
  struct rlimit rlp;
  int i = getrlimit(RLIMIT_NOFILE, &rlp);
  if (i < 0) {
    return -1;
  }
  return (int)rlp.rlim_cur;
}


x86 assembly (clang, -O0):
<maxfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <getrlimit@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1143 <maxfile+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    114a <maxfile+0x3a>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxfile>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <getrlimit@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
js     1130 <maxfile+0x20>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.rlimit = type { i64 }
@RLIMIT_NOFILE = global i32 0
define i32 @maxfile() {
%1 = alloca i32
%2 = alloca %struct.rlimit
%3 = alloca i32
%4 = load i32, i32* @RLIMIT_NOFILE
%5 = call i32 @getrlimit(i32 %4, %struct.rlimit* %2)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 -1, i32* %1
br label %13
9: ; preds = %0
%10 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 0
%11 = load i64, i64* %10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %1
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
%struct.rlimit = type { i64 }
@RLIMIT_NOFILE = global i32 0
define i32 @maxfile() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = load i32, i32* @RLIMIT_NOFILE
%4 = call i32 @getrlimit(i32 %3, %struct.rlimit* %1)
%5 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = icmp sgt i32 %4, -1
%9 = select i1 %8, i32 %7, i32 -1
ret i32 %9
}
/* Type definitions */
typedef int ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void cr_to_lf(char *line, ssize_t linelen, FILE *output_stream) {
  if (linelen >= 1 && line[linelen - 1] == '\r') {
    line[linelen - 1] = '\n';
  }
  fputs(line, output_stream);
}


x86 assembly (clang, -O0):
<cr_to_lf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     1158 <cr_to_lf+0x48>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
jne    1158 <cr_to_lf+0x48>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0xa,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <fputs@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cr_to_lf>:
test   %esi,%esi
jle    1121 <cr_to_lf+0x11>
add    $0xffffffff,%esi
cmpb   $0xd,(%rdi,%rsi,1)
jne    1121 <cr_to_lf+0x11>
movb   $0xa,(%rdi,%rsi,1)
mov    %rdx,%rsi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
define void @cr_to_lf(i8* %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 i32, i32* %5
%8 = icmp sge i32 %7, 1
br i1 %8, label %9, label %24
9: ; preds = %3
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 13
br i1 %17, label %18, label %24
18: ; preds = %9
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
store i8 10, i8* %23
br label %24
24: ; preds = %18, %9, %3
%25 = load i8*, i8** %4
%26 = load i32*, i32** %6
%27 = call i32 @fputs(i8* %25, i32* %26)
ret void
}

LLVM IR (-O2):
define void @cr_to_lf(i8* nocapture %0, i32 %1, i32* nocapture %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = add nsw i32 %1, -1
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 13
br i1 %10, label %11, label %12
11: ; preds = %5
store i8 10, i8* %8
br label %12
12: ; preds = %11, %5, %3
%13 = tail call i32 @fputs(i8* %0, i32* %2)
ret void
}
int test_imm_16uint32_reg(unsigned int val) {
  return ((val) & (0x16 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_16uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x16,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_16uint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 22
%5 = icmp ne i32 %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_16uint32_reg(i32 %0) {
%2 = and i32 %0, 22
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
scalar_t__ max_sum(int *, int);
scalar_t__ max_sum_brute(int *, int);
int test_all_negatives() {
  int input[] = {-8, -4, -1, -9, -4, -5, -3};
  return 0 == max_sum_brute(input, 7) && 0 == max_sum(input, 7);
}


x86 assembly (clang, -O0):
<test_all_negatives>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec9(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1040 <max_sum_brute@plt>
mov    %rax,%rdx
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %rdx,%rcx
mov    %al,-0x21(%rbp)
jne    118f <test_all_negatives+0x6f>
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1030 <max_sum@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_all_negatives>:
sub    $0x28,%rsp
movups 0xee1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1040 <max_sum_brute@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1157 <test_all_negatives+0x37>
add    $0x28,%rsp
ret
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <max_sum@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_all_negatives.input = [7 x i32] [i32 -8, i32 -4, i32 -1, i32 -9, i32 -4, i32 -5, i32 -3]
define i32 @test_all_negatives() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i64 @max_sum_brute(i32* %3, i32 7)
%5 = icmp eq i64 0, %4
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%8 = call i64 @max_sum(i32* %7, i32 7)
%9 = icmp eq i64 0, %8
br label %10
10: ; preds = %6, %0
%11 = phi i1 [ false, %0 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@__const.test_all_negatives.input = [7 x i32] [i32 -8, i32 -4, i32 -1, i32 -9, i32 -4, i32 -5, i32 -3]
define i32 @test_all_negatives() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i64 @max_sum_brute(i32* %3, i32 7)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i64 @max_sum(i32* %3, i32 7)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %0
%11 = phi i32 [ 0, %0 ], [ %9, %6 ]
ret i32 %11
}
void sigfunc(s) int s;
{}


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

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

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

LLVM IR (-O2):
define void @sigfunc(i32 %0) {
ret void
}
void g_mem_chunk_free() {}


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

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

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

LLVM IR (-O2):
define void @g_mem_chunk_free() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Report(char *);
int astGQch(float *chv, float *chh) {
  Report("astGQch");
  return 0;
}


x86 assembly (clang, -O0):
<astGQch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
call   1030 <Report@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"astGQch\00"
define i32 @astGQch(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = call i32 @Report(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"astGQch\00"
define i32 @astGQch(float* nocapture readnone %0, float* nocapture readnone %1) {
%3 = tail call i32 @Report(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, double);
void formatFloat64(char *buffer, size_t size, char *format, double v) {
  snprintf(buffer, size, format, v);
}


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

x86 assembly (clang, -O2):
<formatFloat64>:
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
define void @formatFloat64(i8* %0, i64 %1, i8* %2, double %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca double
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store double %3, double* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i8*, i8** %7
%12 = load double, double* %8
%13 = call i32 @snprintf(i8* %9, i64 %10, i8* %11, double %12)
ret void
}

LLVM IR (-O2):
define void @formatFloat64(i8* %0, i64 %1, i8* %2, double %3) {
%5 = tail call i32 @snprintf(i8* %0, i64 %1, i8* %2, double %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcmp(char *, char *, int);
void memcmp2() {
  char a[] = {1, 2, 3, 4};
  char b[1] = {0};
  memcmp(a, b, 4);
}


x86 assembly (clang, -O0):
<memcmp2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0x5(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <memset@plt>
lea    -0x4(%rbp),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcmp2>:
push   %rax
movl   $0x4030201,0x4(%rsp)
04
movb   $0x0,0x3(%rsp)
lea    0x4(%rsp),%rdi
lea    0x3(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
pop    %rax
ret

LLVM IR (-O0):
@__const.memcmp2.a = [4 x i8] c"\01\02\03\04"
define void @memcmp2() {
%1 = alloca [4 x i8]
%2 = alloca [1 x i8]
%3 = bitcast [4 x i8]* %1 to i8*
%4 = bitcast [1 x i8]* %2 to i8*
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%7 = call i32 @memcmp(i8* %5, i8* %6, i32 4)
ret void
}

LLVM IR (-O2):
define void @memcmp2() {
%1 = alloca i32
%2 = alloca [1 x i8]
%3 = bitcast i32* %1 to i8*
store i32 67305985, i32* %1
%4 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
store i8 0, i8* %4
%5 = call i32 @memcmp(i8* %3, i8* %4, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
void sigchld_handler(int sig) { wait(NULL); }


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

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

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

LLVM IR (-O2):
define void @sigchld_handler(i32 %0) {
%2 = tail call i32 @wait(i32* null)
ret void
}
void uShortToBytes(unsigned short num, unsigned char *bytes) {
  bytes[0] = (unsigned char)(num & 0xFF);
  bytes[1] = (unsigned char)((num >> 8) & 0xFF);
}


x86 assembly (clang, -O0):
<uShortToBytes>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uShortToBytes>:
mov    %di,(%rsi)
ret

LLVM IR (-O0):
define void @uShortToBytes(i16 zeroext %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
store i16 %0, i16* %3
store i8* %1, i8** %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i16, i16* %3
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 8
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 1
store i8 %15, i8* %17
ret void
}

LLVM IR (-O2):
define void @uShortToBytes(i16 zeroext %0, i8* nocapture writeonly %1) {
%3 = trunc i16 %0 to i8
store i8 %3, i8* %1
%4 = lshr i16 %0, 8
%5 = trunc i16 %4 to i8
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ lfs2_aligndown(scalar_t__, scalar_t__);
uint32_t lfs2_alignup(uint32_t a, uint32_t alignment) {
  return lfs2_aligndown(a + alignment - 1, alignment);
}


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

x86 assembly (clang, -O2):
<lfs2_alignup>:
add    %rsi,%rdi
add    $0xffffffffffffffff,%rdi
jmp    1030 <lfs2_aligndown@plt>

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

LLVM IR (-O2):
define i64 @lfs2_alignup(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = tail call i64 @lfs2_aligndown(i64 %4, i64 %1)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stdout;
void print_usage(const char *name) {
  fprintf(stdout, "\nUsage: %s -s <field_size> -p <ppoly>\n\n", name);
}


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

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

LLVM IR (-O0):
@stdout = global i32 0
@.str = [40 x i8] c"\0AUsage: %s -s <field_size> -p <ppoly>\0A\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [40 x i8] c"\0AUsage: %s -s <field_size> -p <ppoly>\0A\0A\00"
define void @print_usage(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct nlattr {
  int dummy;
};
struct nla_policy {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ nla_data(struct nlattr *);
int /*<<< orphan*/ nla_len(struct nlattr *);
int nla_parse(struct nlattr **, int, int /*<<< orphan*/, int /*<<< orphan*/,
              struct nla_policy *);
int nla_parse_nested(struct nlattr *tb[], int maxtype, struct nlattr *nla,
                     struct nla_policy *policy) {
  return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
}


x86 assembly (clang, -O0):
<nla_parse_nested>:
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    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <nla_data@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <nla_len@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    %eax,%ecx
mov    -0x20(%rbp),%r8
call   1050 <nla_parse@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nla_parse_nested>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %rdi,%r12
mov    %rdx,%rdi
call   1040 <nla_data@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <nla_len@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %eax,%ecx
mov    %r14,%r8
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <nla_parse@plt>

LLVM IR (-O0):
%struct.nlattr = type { i32 }
%struct.nla_policy = type { i32 }
define i32 @nla_parse_nested(%struct.nlattr** %0, i32 %1, %struct.nlattr* %2, %struct.nla_policy* %3) {
%5 = alloca %struct.nlattr**
%6 = alloca i32
%7 = alloca %struct.nlattr*
%8 = alloca %struct.nla_policy*
store %struct.nlattr** %0, %struct.nlattr*** %5
store i32 %1, i32* %6
store %struct.nlattr* %2, %struct.nlattr** %7
store %struct.nla_policy* %3, %struct.nla_policy** %8
%9 = load %struct.nlattr**, %struct.nlattr*** %5
%10 = load i32, i32* %6
%11 = load %struct.nlattr*, %struct.nlattr** %7
%12 = call i32 @nla_data(%struct.nlattr* %11)
%13 = load %struct.nlattr*, %struct.nlattr** %7
%14 = call i32 @nla_len(%struct.nlattr* %13)
%15 = load %struct.nla_policy*, %struct.nla_policy** %8
%16 = call i32 @nla_parse(%struct.nlattr** %9, i32 %10, i32 %12, i32 %14, %struct.nla_policy* %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.nlattr = type { i32 }
%struct.nla_policy = type { i32 }
define i32 @nla_parse_nested(%struct.nlattr** %0, i32 %1, %struct.nlattr* %2, %struct.nla_policy* %3) {
%5 = tail call i32 @nla_data(%struct.nlattr* %2)
%6 = tail call i32 @nla_len(%struct.nlattr* %2)
%7 = tail call i32 @nla_parse(%struct.nlattr** %0, i32 %1, i32 %5, i32 %6, %struct.nla_policy* %3)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ i2c_DisableNoiseFilter(int /*<<< orphan*/);
void i2c0_DisableNoiseFilter(void) { i2c_DisableNoiseFilter(0); }


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

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

LLVM IR (-O0):
define void @i2c0_DisableNoiseFilter() {
%1 = call i32 @i2c_DisableNoiseFilter(i32 0)
ret void
}

LLVM IR (-O2):
define void @i2c0_DisableNoiseFilter() {
%1 = tail call i32 @i2c_DisableNoiseFilter(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *mlibc_str_triml(char *);
char *mlibc_str_trimr(char *);
char *mlibc_str_trim(char *str) {
  char *str_triml = mlibc_str_triml(str);
  char *str_trimr = mlibc_str_trimr(str_triml);
  free(str_triml);
  return str_trimr;
}


x86 assembly (clang, -O0):
<mlibc_str_trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <mlibc_str_triml@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <mlibc_str_trimr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlibc_str_trim>:
push   %r14
push   %rbx
push   %rax
call   1040 <mlibc_str_triml@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <mlibc_str_trimr@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @mlibc_str_trim(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @mlibc_str_triml(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @mlibc_str_trimr(i8* %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @free(i8* %9)
%11 = load i8*, i8** %4
ret i8* %11
}

LLVM IR (-O2):
define i8* @mlibc_str_trim(i8* %0) {
%2 = tail call i8* @mlibc_str_triml(i8* %0)
%3 = tail call i8* @mlibc_str_trimr(i8* %2)
%4 = tail call i32 @free(i8* %2)
ret i8* %3
}
void __attribute__((indirect_branch_jump("thunk"))) bar(int *pc) {
  static const void *l[] = {&&lab0, &&end};
  foo(0);
  goto *l[*pc];
lab0:
  foo(0);
  pc++;
  goto *l[*pc];
end:
  return;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
mov    $0x0,%al
call   1030 <foo@plt>
mov    -0x8(%rbp),%rax
movslq (%rax),%rcx
lea    0x2efd(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
jmp    1176 <bar+0x66>
xor    %edi,%edi
mov    $0x0,%al
call   1030 <foo@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rcx
lea    0x2ecd(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
jmp    1176 <bar+0x66>
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rax
jmp    *%rax

x86 assembly (clang, -O2):
<bar>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %edi,%edi
xor    %eax,%eax
call   1030 <foo@plt>
movslq (%rbx),%rax
lea    0x2ce6(%rip),%r14
jmp    *(%r14,%rax,8)
xchg   %ax,%ax
xor    %edi,%edi
xor    %eax,%eax
call   1030 <foo@plt>
add    $0x4,%rbx
movslq (%rbx),%rax
jmp    *(%r14,%rax,8)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@bar.l = internal global [2 x i8*] [i8* blockaddress(@bar, %9), i8* blockaddress(@bar, %18)]
define void @bar(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 (i32, ...) bitcast (i32 (...)* @foo to i32 (i32, ...)*)(i32 0)
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [2 x i8*], [2 x i8*]* @bar.l, i64 0, i64 %6
%8 = load i8*, i8** %7
br label %19
9: ; preds = %19
%10 = call i32 (i32, ...) bitcast (i32 (...)* @foo to i32 (i32, ...)*)(i32 0)
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i32 1
store i32* %12, i32** %2
%13 = load i32*, i32** %2
%14 = load i32, i32* %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [2 x i8*], [2 x i8*]* @bar.l, i64 0, i64 %15
%17 = load i8*, i8** %16
br label %19
18: ; preds = %19
ret void
19: ; preds = %9, %1
%20 = phi i8* [ %8, %1 ], [ %17, %9 ]
indirectbr i8* %20, [label %9, label %18]
}

LLVM IR (-O2):
@bar.l = internal unnamed_addr constant [2 x i8*] [i8* blockaddress(@bar, %3), i8* blockaddress(@bar, %6)]
define void @bar(i32* nocapture %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @foo to i32 (i32, ...)*)(i32 0)
br label %7
3: ; preds = %7
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @foo to i32 (i32, ...)*)(i32 0)
%5 = getelementptr inbounds i32, i32* %8, i64 1
br label %7
6: ; preds = %7
ret void
7: ; preds = %3, %1
%8 = phi i32* [ %0, %1 ], [ %5, %3 ]
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [2 x i8*], [2 x i8*]* @bar.l, i64 0, i64 %10
%12 = load i8*, i8** %11
indirectbr i8* %12, [label %3, label %6]
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int clock_gettime(int /*<<< orphan*/, struct timespec *);
double _getdtime(clockid_t clock_id) {
  struct timespec tp;
  if (clock_gettime(clock_id, &tp) == -1)
    return (-1);
  return ((double)((&tp)->tv_sec) + (double)((&tp)->tv_nsec) / 1000000000.0);
}


x86 assembly (clang, -O0):
<_getdtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
jne    1142 <_getdtime+0x32>
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1163 <_getdtime+0x53>
cvtsi2sdq -0x18(%rbp),%xmm0
cvtsi2sdq -0x20(%rbp),%xmm1
movsd  0xeaa(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_getdtime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
je     1142 <_getdtime+0x32>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  0xecf(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret
movsd  0xeb6(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define double @_getdtime(i32 %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca %struct.timespec
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @clock_gettime(i32 %5, %struct.timespec* %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store double -1.000000e+00, double* %2
br label %18
9: ; preds = %1
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 1
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
%14 = load i64, i64* %13
%15 = sitofp i64 %14 to double
%16 = fdiv double %15, 1.000000e+09
%17 = fadd double %12, %16
store double %17, double* %2
br label %18
18: ; preds = %9, %8
%19 = load double, double* %2
ret double %19
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define double @_getdtime(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = call i32 @clock_gettime(i32 %0, %struct.timespec* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %15, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
%13 = fdiv double %12, 1.000000e+09
%14 = fadd double %13, %9
br label %15
15: ; preds = %1, %6
%16 = phi double [ %14, %6 ], [ -1.000000e+00, %1 ]
ret double %16
}
/* Variables and functions */
int /*<<< orphan*/ digitalWrite(int /*<<< orphan*/, int);
int /*<<< orphan*/ pinMode(int /*<<< orphan*/, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ wiringXSetup();
int main(void) {
  wiringXSetup();
  pinMode(0, 1);
  while (1) {
    digitalWrite(0, 1);
    sleep(1);
    digitalWrite(0, 0);
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <wiringXSetup@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <pinMode@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <digitalWrite@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <digitalWrite@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    1162 <main+0x22>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <wiringXSetup@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <pinMode@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <digitalWrite@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <digitalWrite@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    1160 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @wiringXSetup()
%3 = call i32 @pinMode(i32 0, i32 1)
br label %4
4: ; preds = %0, %4
%5 = call i32 @digitalWrite(i32 0, i32 1)
%6 = call i32 @sleep(i32 1)
%7 = call i32 @digitalWrite(i32 0, i32 0)
%8 = call i32 @sleep(i32 1)
br label %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @wiringXSetup()
%2 = tail call i32 @pinMode(i32 0, i32 1)
br label %3
3: ; preds = %0, %3
%4 = tail call i32 @digitalWrite(i32 0, i32 1)
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @digitalWrite(i32 0, i32 0)
%7 = tail call i32 @sleep(i32 1)
br label %3
}
/* Variables and functions */
int abs(int);
int find_decrease(int field, int totake, int min) {
  if (field == min)
    return 0;
  if (field - totake >= min) {
    return totake;
  } else {
    return totake - abs(field - totake);
  }
}


x86 assembly (clang, -O0):
<find_decrease>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1139 <find_decrease+0x29>
movl   $0x0,-0x4(%rbp)
jmp    116e <find_decrease+0x5e>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1153 <find_decrease+0x43>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <find_decrease+0x5e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_decrease>:
xor    %eax,%eax
cmp    %edx,%edi
je     1117 <find_decrease+0x17>
sub    %esi,%edi
cmp    %edx,%edi
jge    1115 <find_decrease+0x15>
mov    %edi,%eax
neg    %eax
cmovns %edi,%eax
add    %eax,%esi
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @find_decrease(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, %2
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = sub nsw i32 %0, %1
%7 = icmp slt i32 %6, %2
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i32 @llvm.abs.i32(i32 %6, i1 true)
%10 = sub nsw i32 %1, %9
br label %11
11: ; preds = %5, %3, %8
%12 = phi i32 [ %10, %8 ], [ 0, %3 ], [ %1, %5 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int android_atomic_cas(int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/ volatile *);
int /*<<< orphan*/ android_memory_barrier();
extern __attribute__((always_)) int
android_atomic_acquire_cas(int32_t old_value, int32_t new_value,
                           volatile int32_t *ptr) {
  int status = android_atomic_cas(old_value, new_value, ptr);
  android_memory_barrier();
  return status;
}


x86 assembly (clang, -O0):
<android_atomic_acquire_cas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <android_atomic_cas@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <android_memory_barrier@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<android_atomic_acquire_cas>:
push   %rbx
call   1040 <android_atomic_cas@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <android_memory_barrier@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @android_atomic_acquire_cas(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32*, i32** %6
%11 = call i32 @android_atomic_cas(i32 %8, i32 %9, i32* %10)
store i32 %11, i32* %7
%12 = call i32 (...) @android_memory_barrier()
%13 = load i32, i32* %7
ret i32 %13
}

LLVM IR (-O2):
define i32 @android_atomic_acquire_cas(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @android_atomic_cas(i32 %0, i32 %1, i32* %2)
%5 = tail call i32 (...) @android_memory_barrier()
ret i32 %4
}
/* Type definitions */
struct rtattr {
  int dummy;
};

/* Variables and functions */
const char *rta_getattr_str(const struct rtattr *rta) {
  return (const char *)((
      void *)(((char *)(rta)) +
              ((((sizeof(struct rtattr)) + 4 - 1) & ~(4 - 1)) + (0))));
}


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

x86 assembly (clang, -O2):
<rta_getattr_str>:
lea    0x4(%rdi),%rax
ret

LLVM IR (-O0):
%struct.rtattr = type { i32 }
define i8* @rta_getattr_str(%struct.rtattr* %0) {
%2 = alloca %struct.rtattr*
store %struct.rtattr* %0, %struct.rtattr** %2
%3 = load %struct.rtattr*, %struct.rtattr** %2
%4 = bitcast %struct.rtattr* %3 to i8*
%5 = getelementptr inbounds i8, i8* %4, i64 4
ret i8* %5
}

LLVM IR (-O2):
%struct.rtattr = type { i32 }
define i8* @rta_getattr_str(%struct.rtattr* readnone %0) {
%2 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %0, i64 1
%3 = bitcast %struct.rtattr* %2 to i8*
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ IsTraced();
int /*<<< orphan*/ NotTraced();
int /*<<< orphan*/ SIGUSR2;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  IsTraced();
  NotTraced();
  kill(getpid(), SIGUSR2);
  IsTraced();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <IsTraced@plt>
mov    $0x0,%al
call   1060 <NotTraced@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
call   1050 <kill@plt>
mov    $0x0,%al
call   1040 <IsTraced@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <IsTraced@plt>
xor    %eax,%eax
call   1060 <NotTraced@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    0x2e83(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1050 <kill@plt>
xor    %eax,%eax
call   1040 <IsTraced@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGUSR2 = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @IsTraced()
%3 = call i32 (...) @NotTraced()
%4 = call i32 (...) @getpid()
%5 = load i32, i32* @SIGUSR2
%6 = call i32 @kill(i32 %4, i32 %5)
%7 = call i32 (...) @IsTraced()
ret i32 0
}

LLVM IR (-O2):
@SIGUSR2 = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @IsTraced()
%2 = tail call i32 (...) @NotTraced()
%3 = tail call i32 (...) @getpid()
%4 = load i32, i32* @SIGUSR2
%5 = tail call i32 @kill(i32 %3, i32 %4)
%6 = tail call i32 (...) @IsTraced()
ret i32 0
}
unsigned int get_module_rev(struct ssp_data *data) { return 15081300; }


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

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

LLVM IR (-O0):
%struct.ssp_data = type opaque
define i32 @get_module_rev(%struct.ssp_data* %0) {
%2 = alloca %struct.ssp_data*
store %struct.ssp_data* %0, %struct.ssp_data** %2
ret i32 15081300
}

LLVM IR (-O2):
%struct.ssp_data = type opaque
define i32 @get_module_rev(%struct.ssp_data* nocapture readnone %0) {
ret i32 15081300
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  int isEven(int number);
  if (isEven(17) == 1)
    printf("yes\n");
  else
    printf("no\n");
  if (isEven(20) == 1)
    printf("yes\n");
  else
    printf("no\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x11,%edi
call   1040 <isEven@plt>
cmp    $0x1,%eax
jne    1153 <main+0x33>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    115f <main+0x3f>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    $0x14,%edi
call   1040 <isEven@plt>
cmp    $0x1,%eax
jne    1183 <main+0x63>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
jmp    118f <main+0x6f>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x11,%edi
call   1040 <isEven@plt>
cmp    $0x1,%eax
lea    0xecb(%rip),%r14
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
cmove  %r14,%rdi
call   1030 <puts@plt>
mov    $0x14,%edi
call   1040 <isEven@plt>
cmp    $0x1,%eax
cmove  %r14,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@str.2 = [3 x i8] c"no\00"
@str.4 = [4 x i8] c"yes\00"
define i32 @main() {
%1 = tail call i32 @isEven(i32 17)
%2 = icmp eq i32 %1, 1
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.2, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
%5 = tail call i32 @isEven(i32 20)
%6 = icmp eq i32 %5, 1
%7 = select i1 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.2, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glTranslated(double, double, double);
int /*<<< orphan*/ glutSolidSphere(double, int, int);
void kula(double x, double y, double z) {
  glPushMatrix();
  glTranslated(x, y, z);
  glutSolidSphere(0.1, 60, 20);
  glPopMatrix();
}


x86 assembly (clang, -O0):
<kula>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    $0x0,%al
call   1040 <glPushMatrix@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1060 <glTranslated@plt>
movsd  0xe86(%rip),%xmm0
mov    $0x3c,%edi
mov    $0x14,%esi
call   1050 <glutSolidSphere@plt>
mov    $0x0,%al
call   1030 <glPopMatrix@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kula>:
sub    $0x18,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <glPushMatrix@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
call   1060 <glTranslated@plt>
movsd  0xe86(%rip),%xmm0
mov    $0x3c,%edi
mov    $0x14,%esi
call   1050 <glutSolidSphere@plt>
xor    %eax,%eax
add    $0x18,%rsp
jmp    1030 <glPopMatrix@plt>

LLVM IR (-O0):
define void @kula(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = call i32 (...) @glPushMatrix()
%8 = load double, double* %4
%9 = load double, double* %5
%10 = load double, double* %6
%11 = call i32 @glTranslated(double %8, double %9, double %10)
%12 = call i32 @glutSolidSphere(double 1.000000e-01, i32 60, i32 20)
%13 = call i32 (...) @glPopMatrix()
ret void
}

LLVM IR (-O2):
define void @kula(double %0, double %1, double %2) {
%4 = tail call i32 (...) @glPushMatrix()
%5 = tail call i32 @glTranslated(double %0, double %1, double %2)
%6 = tail call i32 @glutSolidSphere(double 1.000000e-01, i32 60, i32 20)
%7 = tail call i32 (...) @glPopMatrix()
ret void
}
void dist_fini() { return; }


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

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

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

LLVM IR (-O2):
define void @dist_fini() {
ret void
}
void query_newnamebuf(void) { ((void)"query_newnamebuf"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"query_newnamebuf\00"
define void @query_newnamebuf() {
ret void
}

LLVM IR (-O2):
define void @query_newnamebuf() {
ret void
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double time_diff(struct timeval *, struct timeval *);
double timer_interval(struct timeval *start) {
  struct timeval end;
  gettimeofday(&end, NULL);
  return time_diff(&end, start);
}


x86 assembly (clang, -O0):
<timer_interval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1040 <time_diff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_interval>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <time_diff@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define double @timer_interval(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
%3 = alloca %struct.timeval
store %struct.timeval* %0, %struct.timeval** %2
%4 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%5 = load %struct.timeval*, %struct.timeval** %2
%6 = call double @time_diff(%struct.timeval* %3, %struct.timeval* %5)
ret double %6
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define double @timer_interval(%struct.timeval* %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = call double @time_diff(%struct.timeval* %2, %struct.timeval* %0)
ret double %5
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int write_standard_target_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(12, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<write_standard_target_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xc,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_standard_target_system>:
mov    $0xc,%edi
jmp    1030 <_ada_use_c2phc@plt>

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

LLVM IR (-O2):
define i32 @write_standard_target_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 12, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Type definitions */
struct __sk_buff {
  int dummy;
};

/* Variables and functions */
int TC_ACT_OK;
__attribute__((section("action-ok"), used)) int action_ok(struct __sk_buff *s) {
  return TC_ACT_OK;
}


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

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

LLVM IR (-O0):
%struct.__sk_buff = type { i32 }
@TC_ACT_OK = global i32 0
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.__sk_buff*)* @action_ok to i8*)], section "llvm.metadata"
define i32 @action_ok(%struct.__sk_buff* %0) section "action-ok" {
%2 = alloca %struct.__sk_buff*
store %struct.__sk_buff* %0, %struct.__sk_buff** %2
%3 = load i32, i32* @TC_ACT_OK
ret i32 %3
}

LLVM IR (-O2):
%struct.__sk_buff = type { i32 }
@TC_ACT_OK = global i32 0
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.__sk_buff*)* @action_ok to i8*)], section "llvm.metadata"
define i32 @action_ok(%struct.__sk_buff* nocapture readnone %0) section "action-ok" {
%2 = load i32, i32* @TC_ACT_OK
ret i32 %2
}
int funcB() { return 2; }


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

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

LLVM IR (-O0):
define i32 @funcB() {
ret i32 2
}

LLVM IR (-O2):
define i32 @funcB() {
ret i32 2
}