xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ default_line_gwt();
int /*<<< orphan*/ ellipse1(double, double, double, double);
int /*<<< orphan*/ set_line_gwt(double, double, int);
void ellipse(double x1, double y1, double rx, double ry, double g, double w,
             int it) {
  set_line_gwt(g, w, it);
  ellipse1(x1, y1, rx, ry);
  default_line_gwt();
}


x86 assembly (clang, -O0):
<ellipse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
mov    %edi,-0x34(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    -0x34(%rbp),%edi
call   1030 <set_line_gwt@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
call   1050 <ellipse1@plt>
mov    $0x0,%al
call   1040 <default_line_gwt@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ellipse>:
sub    $0x28,%rsp
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movaps %xmm4,%xmm0
movaps %xmm5,%xmm1
call   1030 <set_line_gwt@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
call   1050 <ellipse1@plt>
xor    %eax,%eax
add    $0x28,%rsp
jmp    1040 <default_line_gwt@plt>

LLVM IR (-O0):
define void @ellipse(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store i32 %6, i32* %14
%15 = load double, double* %12
%16 = load double, double* %13
%17 = load i32, i32* %14
%18 = call i32 @set_line_gwt(double %15, double %16, i32 %17)
%19 = load double, double* %8
%20 = load double, double* %9
%21 = load double, double* %10
%22 = load double, double* %11
%23 = call i32 @ellipse1(double %19, double %20, double %21, double %22)
%24 = call i32 (...) @default_line_gwt()
ret void
}

LLVM IR (-O2):
define void @ellipse(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6) {
%8 = tail call i32 @set_line_gwt(double %4, double %5, i32 %6)
%9 = tail call i32 @ellipse1(double %0, double %1, double %2, double %3)
%10 = tail call i32 (...) @default_line_gwt()
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t read_be_u32(const uint8_t *src) {
  return ((uint32_t)src[3]) | ((uint32_t)src[2] << 8) |
         ((uint32_t)src[1] << 16) | ((uint32_t)src[0] << 24);
}


x86 assembly (clang, -O0):
<read_be_u32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_be_u32>:
mov    0x10(%rdi),%ecx
shl    $0x8,%ecx
or     0x18(%rdi),%ecx
mov    (%rdi),%eax
mov    0x8(%rdi),%edx
shl    $0x10,%edx
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @read_be_u32(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = getelementptr inbounds i64, i64* %3, i64 3
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = load i64*, i64** %2
%8 = getelementptr inbounds i64, i64* %7, i64 2
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
%13 = load i64*, i64** %2
%14 = getelementptr inbounds i64, i64* %13, i64 1
%15 = load i64, i64* %14
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 16
%18 = or i32 %12, %17
%19 = load i64*, i64** %2
%20 = getelementptr inbounds i64, i64* %19, i64 0
%21 = load i64, i64* %20
%22 = trunc i64 %21 to i32
%23 = shl i32 %22, 24
%24 = or i32 %18, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @read_be_u32(i64* nocapture %0) {
%2 = getelementptr inbounds i64, i64* %0, i64 3
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds i64, i64* %0, i64 2
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = shl i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i64, i64* %0, i64 1
%11 = load i64, i64* %10
%12 = trunc i64 %11 to i32
%13 = shl i32 %12, 16
%14 = or i32 %9, %13
%15 = load i64, i64* %0
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 24
%18 = or i32 %14, %17
ret i32 %18
}
double pow(double x __attribute__((unused)), double y __attribute__((unused))) {
  return 0.0;
}


x86 assembly (clang, -O0):
<pow>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @pow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @pow(double %0, double %1) {
ret double 0.000000e+00
}
void MemClr_lc898122(unsigned char *NcTgtPtr, unsigned short UsClrSiz) {
  unsigned short UsClrIdx;
  for (UsClrIdx = 0; UsClrIdx < UsClrSiz; UsClrIdx++) {
    *NcTgtPtr = 0;
    NcTgtPtr++;
  }
}


x86 assembly (clang, -O0):
<MemClr_lc898122>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movw   $0x0,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
movzwl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jge    1149 <MemClr_lc898122+0x49>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    1115 <MemClr_lc898122+0x15>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MemClr_lc898122>:
test   %esi,%esi
je     1123 <MemClr_lc898122+0x13>
push   %rax
movzwl %si,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @MemClr_lc898122(i8* %0, i16 zeroext %1) {
%3 = alloca i8*
%4 = alloca i16
%5 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
store i16 0, i16* %5
br label %6
6: ; preds = %16, %2
%7 = load i16, i16* %5
%8 = zext i16 %7 to i32
%9 = load i16, i16* %4
%10 = zext i16 %9 to i32
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %19
12: ; preds = %6
%13 = load i8*, i8** %3
store i8 0, i8* %13
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
br label %16
16: ; preds = %12
%17 = load i16, i16* %5
%18 = add i16 %17, 1
store i16 %18, i16* %5
br label %6
19: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @MemClr_lc898122(i8* nocapture writeonly %0, i16 zeroext %1) {
%3 = icmp eq i16 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i16 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
void gtk_icon_source_free() {}


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

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

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

LLVM IR (-O2):
define void @gtk_icon_source_free() {
ret void
}
/* Variables and functions */
int socket(int, int, int);
int xsocket(int domain, int type, int protocol) {
  int fd = socket(domain, type, protocol);
  if (fd == -1) {
    ;
  }
  return fd;
}


x86 assembly (clang, -O0):
<xsocket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <socket@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    1141 <xsocket+0x31>
jmp    1141 <xsocket+0x31>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xsocket>:
jmp    1030 <socket@plt>

LLVM IR (-O0):
define i32 @xsocket(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 @socket(i32 %8, i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %3
br label %15
15: ; preds = %14, %3
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
define i32 @xsocket(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fclose(int /*<<< orphan*/ *);
int perf_map_close(FILE *fp) {
  if (fp)
    return fclose(fp);
  else
    return 0;
}


x86 assembly (clang, -O0):
<perf_map_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1138 <perf_map_close+0x28>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    %eax,-0x4(%rbp)
jmp    113f <perf_map_close+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perf_map_close>:
test   %rdi,%rdi
je     111a <perf_map_close+0xa>
jmp    1030 <fclose@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @perf_map_close(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @fclose(i32* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int validate_solutions(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(9, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<validate_solutions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x9,%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):
<validate_solutions>:
mov    $0x9,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @validate_solutions() {
%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 9, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @validate_solutions() {
%1 = tail call i32 @_ada_use_c2phc(i32 9, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct stat {
  int /*<<< orphan*/ st_mtime;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
time_t timestamp_file(const char *filename) {
  struct stat buf;
  if (stat(filename, &buf) == 0) {
    return buf.st_mtime;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<timestamp_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    113e <timestamp_file+0x2e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1145 <timestamp_file+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timestamp_file>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1126 <timestamp_file+0x16>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @timestamp_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @timestamp_file(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 %7, i32 0
ret i32 %8
}
/* Type definitions */
typedef union sigval {
  int dummy;
} sigval;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __sigqueue(pid_t pid, int sig, const union sigval val) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__sigqueue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edx,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sigqueue>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%union.sigval = type { i32 }
@ENOSYS = global i32 0
define i32 @__sigqueue(i32 %0, i32 %1, i32 %2) {
%4 = alloca %union.sigval
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds %union.sigval, %union.sigval* %4, i32 0, i32 0
store i32 %2, i32* %7
store i32 %0, i32* %5
store i32 %1, i32* %6
%8 = load i32, i32* @ENOSYS
%9 = call i32 @__set_errno(i32 %8)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @__sigqueue(i32 %0, i32 %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
%5 = tail call i32 @__set_errno(i32 %4)
ret i32 -1
}
char *getEnumScope(int value) {
  switch (value) {
  case 0:
    return "NOLL_SCOPE_LOCAL";
  case 1:
    return "NOLL_SCOPE_GLOBAL";
  default:
    return "NOLL_SCOPE_OTHER";
  }
}


x86 assembly (clang, -O0):
<getEnumScope>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     112b <getEnumScope+0x2b>
jmp    111a <getEnumScope+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     113b <getEnumScope+0x3b>
jmp    114b <getEnumScope+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <getEnumScope+0x56>
lea    0xecf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <getEnumScope+0x56>
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getEnumScope>:
cmp    $0x1,%edi
lea    0xf07(%rip),%rax
lea    0xf12(%rip),%rcx
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee2(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c"NOLL_SCOPE_LOCAL\00"
@.str.1 = [18 x i8] c"NOLL_SCOPE_GLOBAL\00"
@.str.2 = [17 x i8] c"NOLL_SCOPE_OTHER\00"
define i8* @getEnumScope(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [17 x i8] c"NOLL_SCOPE_LOCAL\00"
@.str.1 = [18 x i8] c"NOLL_SCOPE_GLOBAL\00"
@.str.2 = [17 x i8] c"NOLL_SCOPE_OTHER\00"
define i8* @getEnumScope(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
void vdriver_flush_display(void) {}


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

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

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

LLVM IR (-O2):
define void @vdriver_flush_display() {
ret void
}
int g(int i, int j, int k) {
  int a = 3;
  int b = 5;
  int c = 7;
  return a + b + c + i + j + k;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
movl   $0x7,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
add    %esi,%edi
lea    (%rdx,%rdi,1),%eax
add    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @g(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 3, i32* %7
store i32 5, i32* %8
store i32 7, i32* %9
%10 = load i32, i32* %7
%11 = load i32, i32* %8
%12 = add nsw i32 %10, %11
%13 = load i32, i32* %9
%14 = add nsw i32 %12, %13
%15 = load i32, i32* %4
%16 = add nsw i32 %14, %15
%17 = load i32, i32* %5
%18 = add nsw i32 %16, %17
%19 = load i32, i32* %6
%20 = add nsw i32 %18, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @g(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %0, 15
%5 = add nsw i32 %4, %1
%6 = add nsw i32 %5, %2
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
__attribute__((__cold__)) void cheat_print_version(void) {
  (void)fputs("CHEAT 1.0.0", stdout);
  (void)fputc('\n', stdout);
}


x86 assembly (clang, -O0):
<cheat_print_version>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cheat_print_version>:
push   %rbx
mov    0x2f78(%rip),%rbx
mov    (%rbx),%esi
lea    0xf8f(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
pop    %rbx
jmp    1040 <fputc@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)

LLVM IR (-O0):
@.str = [12 x i8] c"CHEAT 1.0.0\00"
@stdout = global i32 0
define void @cheat_print_version() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @stdout
%4 = call i32 @fputc(i8 signext 10, i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"CHEAT 1.0.0\00"
@stdout = global i32 0
define void @cheat_print_version() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fputc(i8 signext 10, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double);
int main() {
  double a = 111.1;
  double b = 999.9;
  printf("a:%f  b:%f\n", a, b);
  int tmp;
  tmp = a;
  a = b;
  b = tmp;
  ;
  printf("after swap:\na:%f  b:%f\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
cvttsd2si -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf0c(%rip),%rdi
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
movsd  0xed4(%rip),%xmm1
movsd  0xec4(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"a:%f b:%f\0A\00"
@.str.1 = [24 x i8] c"after swap:\0Aa:%f b:%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store i32 0, i32* %1
store double 1.111000e+02, double* %2
store double 0x408F3F3333333333, double* %3
%5 = load double, double* %2
%6 = load double, double* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %5, double %6)
%8 = load double, double* %2
%9 = fptosi double %8 to i32
store i32 %9, i32* %4
%10 = load double, double* %3
store double %10, double* %2
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
store double %12, double* %3
%13 = load double, double* %2
%14 = load double, double* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %13, double %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"a:%f b:%f\0A\00"
@.str.1 = [24 x i8] c"after swap:\0Aa:%f b:%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 1.111000e+02, double 0x408F3F3333333333)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double 0x408F3F3333333333, double 1.110000e+02)
ret i32 0
}
void sigchld_handler(int asig __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define void @sigchld_handler(i32 %0) {
ret void
}
unsigned int _log10(unsigned int x) {
  unsigned int ans = 0;
  while (x /= 10) {
    ans++;
  }
  return ans;
}


x86 assembly (clang, -O0):
<_log10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     1134 <_log10+0x34>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <_log10+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_log10>:
xor    %eax,%eax
cmp    $0xa,%edi
jb     1124 <_log10+0x24>
xor    %eax,%eax
mov    $0xcccccccd,%ecx
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x63,%edi
mov    %edx,%edi
ja     1110 <_log10+0x10>
ret

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

LLVM IR (-O2):
define i32 @_log10(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i32 %5, 10
%7 = add i32 %4, 1
%8 = icmp ult i32 %5, 100
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
int main(int argc, char *argv[]) {
  int a, b;
  a = 1;
  b = 2;
  return (a + b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 3
}
/* Variables and functions */
char itoc(int);
int /*<<< orphan*/ printf(char *);
void test_itoc() {
  char c = itoc(3);
  if (c == '3') {
    printf("itoc passed\n");
  } else {
    printf("itoc failed\n");
  }
}


x86 assembly (clang, -O0):
<test_itoc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
call   1040 <itoc@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x33,%eax
jne    1153 <test_itoc+0x33>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    115f <test_itoc+0x3f>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_itoc>:
push   %rax
mov    $0x3,%edi
call   1040 <itoc@plt>
cmp    $0x33,%al
lea    0xed8(%rip),%rax
lea    0xec5(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"itoc passed\0A\00"
@.str.1 = [13 x i8] c"itoc failed\0A\00"
define void @test_itoc() {
%1 = alloca i8
%2 = call signext i8 @itoc(i32 3)
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 51
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"itoc failed\00"
@str.2 = [12 x i8] c"itoc passed\00"
define void @test_itoc() {
%1 = tail call signext i8 @itoc(i32 3)
%2 = icmp eq i8 %1, 51
%3 = select i1 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
void chomp(const char *s) {
  char *p;
  while (NULL != s && NULL != (p = strrchr(s, '\n'))) {
    *p = '\0';
  }
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x8(%rbp),%rcx
mov    %al,-0x11(%rbp)
je     114d <chomp+0x3d>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strrchr@plt>
mov    %rax,%rcx
mov    %rcx,-0x10(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115d <chomp+0x4d>
jmp    1169 <chomp+0x59>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    111c <chomp+0xc>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
push   %rbx
test   %rdi,%rdi
je     1137 <chomp+0x27>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1137 <chomp+0x27>
movb   $0x0,(%rax)
jmp    1120 <chomp+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @chomp(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i8* @strrchr(i8* %0, i8 signext 10)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %8, %6 ], [ %4, %3 ]
store i8 0, i8* %7
%8 = tail call i8* @strrchr(i8* %0, i8 signext 10)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %6
10: ; preds = %6, %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void die(const char *arg) {
  printf("%s\n", arg);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @die(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
int exchange(int *a, int *b) {
  *a = *a + *b;
  *b = *a - *b;
  *a = *a - *b;
}


x86 assembly (clang, -O0):
<exchange>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
add    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
sub    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
sub    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exchange>:
mov    (%rsi),%eax
add    (%rdi),%eax
mov    %eax,(%rdi)
sub    (%rsi),%eax
mov    %eax,(%rsi)
sub    %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @exchange(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = add nsw i32 %7, %9
%11 = load i32*, i32** %4
store i32 %10, i32* %11
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
%16 = sub nsw i32 %13, %15
%17 = load i32*, i32** %5
store i32 %16, i32* %17
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = sub nsw i32 %19, %21
%23 = load i32*, i32** %4
store i32 %22, i32* %23
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @exchange(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = add nsw i32 %4, %3
store i32 %5, i32* %0
%6 = load i32, i32* %1
%7 = sub nsw i32 %5, %6
store i32 %7, i32* %1
%8 = load i32, i32* %0
%9 = sub nsw i32 %8, %7
store i32 %9, i32* %0
ret i32 undef
}
/* Type definitions */
struct drm_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ DRM_ERROR(char *, int);
void mga_disable_vblank(struct drm_device *dev, int crtc) {
  if (crtc != 0) {
    DRM_ERROR("tried to disable vblank on non-existent crtc %d\n", crtc);
  }
}


x86 assembly (clang, -O0):
<mga_disable_vblank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1138 <mga_disable_vblank+0x28>
mov    -0xc(%rbp),%esi
lea    0xecd(%rip),%rdi
call   1030 <DRM_ERROR@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mga_disable_vblank>:
test   %esi,%esi
je     1120 <mga_disable_vblank+0x10>
lea    0xee5(%rip),%rdi
jmp    1030 <DRM_ERROR@plt>
ret

LLVM IR (-O0):
%struct.drm_device = type { i32 }
@.str = [49 x i8] c"tried to disable vblank on non-existent crtc %d\0A\00"
define void @mga_disable_vblank(%struct.drm_device* %0, i32 %1) {
%3 = alloca %struct.drm_device*
%4 = alloca i32
store %struct.drm_device* %0, %struct.drm_device** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = call i32 @DRM_ERROR(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
%struct.drm_device = type { i32 }
@.str = [49 x i8] c"tried to disable vblank on non-existent crtc %d\0A\00"
define void @mga_disable_vblank(%struct.drm_device* nocapture readnone %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @DRM_ERROR(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %6
6: ; preds = %4, %2
ret void
}
int sysStrgetword(unsigned char *src, int len, int ind) {
  int n;
  if ((ind < 0) || (ind + 2 > len))
    return -1;
  n = (src[ind] << 8) + src[ind + 1];
  return n;
}


x86 assembly (clang, -O0):
<sysStrgetword>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1127 <sysStrgetword+0x27>
mov    -0x18(%rbp),%eax
add    $0x2,%eax
cmp    -0x14(%rbp),%eax
jle    1133 <sysStrgetword+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    115e <sysStrgetword+0x5e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysStrgetword>:
mov    $0xffffffff,%eax
test   %edx,%edx
js     111b <sysStrgetword+0x1b>
lea    0x2(%rdx),%ecx
cmp    %esi,%ecx
jg     111b <sysStrgetword+0x1b>
mov    %edx,%eax
movzwl (%rdi,%rax,1),%eax
shl    $0x10,%eax
bswap  %eax
ret

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

LLVM IR (-O2):
define i32 @sysStrgetword(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, 0
%5 = add nsw i32 %2, 2
%6 = icmp sgt i32 %5, %1
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %20, label %8
8: ; preds = %3
%9 = zext i32 %2 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = add nuw nsw i32 %2, 1
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = or i32 %13, %18
br label %20
20: ; preds = %3, %8
%21 = phi i32 [ %19, %8 ], [ -1, %3 ]
ret i32 %21
}
/* Variables and functions */
char const *weak_l3();
const char *__attribute__((section(".test.c"))) call_weak_l3(void) {
  return weak_l3() + 1;
}


x86 assembly (clang, -O0):
<call_weak_l3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <weak_l3@plt>
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_weak_l3>:
push   %rax
xor    %eax,%eax
call   1030 <weak_l3@plt>
add    $0x1,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @call_weak_l3() section ".test.c" {
%1 = call i8* (...) @weak_l3()
%2 = getelementptr inbounds i8, i8* %1, i64 1
ret i8* %2
}

LLVM IR (-O2):
define i8* @call_weak_l3() section ".test.c" {
%1 = tail call i8* (...) @weak_l3()
%2 = getelementptr inbounds i8, i8* %1, i64 1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fclose(int /*<<< orphan*/ *);
int zomp_closeFile(void *file) { return fclose((FILE *)file); }


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

x86 assembly (clang, -O2):
<zomp_closeFile>:
jmp    1030 <fclose@plt>

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

LLVM IR (-O2):
define i32 @zomp_closeFile(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @fclose(i32* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ SIGUSR2;
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
void notify_client() { kill(0, SIGUSR2); }


x86 assembly (clang, -O0):
<notify_client>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1030 <kill@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<notify_client>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
jmp    1030 <kill@plt>

LLVM IR (-O0):
@SIGUSR2 = global i32 0
define void @notify_client() {
%1 = load i32, i32* @SIGUSR2
%2 = call i32 @kill(i32 0, i32 %1)
ret void
}

LLVM IR (-O2):
@SIGUSR2 = global i32 0
define void @notify_client() {
%1 = load i32, i32* @SIGUSR2
%2 = tail call i32 @kill(i32 0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nullf(char *, int);
int /*<<< orphan*/ output_byte(int);
void emit_fmul(int r) {
  nullf("fmul st%d\n", r);
  output_byte(0xd8);
  output_byte(0xc8 + r);
}


x86 assembly (clang, -O0):
<emit_fmul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <nullf@plt>
mov    $0xd8,%edi
call   1040 <output_byte@plt>
mov    -0x4(%rbp),%edi
add    $0xc8,%edi
call   1040 <output_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fmul>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <nullf@plt>
mov    $0xd8,%edi
call   1040 <output_byte@plt>
add    $0xc8,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <output_byte@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"fmul st%d\0A\00"
define void @emit_fmul(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @nullf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @output_byte(i32 216)
%6 = load i32, i32* %2
%7 = add nsw i32 200, %6
%8 = call i32 @output_byte(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"fmul st%d\0A\00"
define void @emit_fmul(i32 %0) {
%2 = tail call i32 @nullf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @output_byte(i32 216)
%4 = add nsw i32 %0, 200
%5 = tail call i32 @output_byte(i32 %4)
ret void
}
void INT_Excep_CMPB1_CMPB2(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_CMPB1_CMPB2() {
ret void
}
void null_show_device(void *ui, const char *title, struct aq_device *dev) {}


x86 assembly (clang, -O0):
<null_show_device>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.aq_device = type opaque
define void @null_show_device(i8* %0, i8* %1, %struct.aq_device* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.aq_device*
store i8* %0, i8** %4
store i8* %1, i8** %5
store %struct.aq_device* %2, %struct.aq_device** %6
ret void
}

LLVM IR (-O2):
%struct.aq_device = type opaque
define void @null_show_device(i8* nocapture %0, i8* nocapture %1, %struct.aq_device* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ shuffle(void *, size_t, size_t);
int /*<<< orphan*/ sort(void *, size_t, size_t,
                        int (*)(void const *, void const *, void *), void *,
                        int /*<<< orphan*/, size_t);
void quick_sort_3way(void *base, size_t nmemb, size_t size,
                     int (*compare)(const void *a, const void *b,
                                    void *context),
                     void *context) {
  shuffle(base, nmemb, size);
  sort(base, nmemb, size, compare, context, 0, nmemb - 1);
}


x86 assembly (clang, -O0):
<quick_sort_3way>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <shuffle@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
xor    %r9d,%r9d
mov    %rax,(%rsp)
call   1040 <sort@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort_3way>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r13
call   1030 <shuffle@plt>
lea    -0x1(%rbx),%rax
mov    %rax,(%rsp)
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %r9d,%r9d
call   1040 <sort@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @quick_sort_3way(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*, i8*)* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32 (i8*, i8*, i8*)*
%10 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i32 (i8*, i8*, i8*)* %3, i32 (i8*, i8*, i8*)** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = call i32 @shuffle(i8* %11, i64 %12, i64 %13)
%15 = load i8*, i8** %6
%16 = load i64, i64* %7
%17 = load i64, i64* %8
%18 = load i32 (i8*, i8*, i8*)*, i32 (i8*, i8*, i8*)** %9
%19 = load i8*, i8** %10
%20 = load i64, i64* %7
%21 = sub i64 %20, 1
%22 = call i32 @sort(i8* %15, i64 %16, i64 %17, i32 (i8*, i8*, i8*)* %18, i8* %19, i32 0, i64 %21)
ret void
}

LLVM IR (-O2):
define void @quick_sort_3way(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*, i8*)* %3, i8* %4) {
%6 = tail call i32 @shuffle(i8* %0, i64 %1, i64 %2)
%7 = add i64 %1, -1
%8 = tail call i32 @sort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*, i8*)* %3, i8* %4, i32 0, i64 %7)
ret void
}
void dd_pbl_ios_fb_init() {}


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

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

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

LLVM IR (-O2):
define void @dd_pbl_ios_fb_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void my_exit2(void) { printf("my exit2 ... \n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"my exit2 ... \00"
define void @my_exit2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int scan_for_intN(char const *, int, long long *, char const **);
int scan_for_int16(const char *_str, short *ret_, const char **end_) {
  long long ret;
  int b_err = scan_for_intN(_str, 16, &ret, end_);
  if (ret_) {
    *ret_ = (short)ret;
  }
  return b_err;
}


x86 assembly (clang, -O0):
<scan_for_int16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x10,%esi
lea    -0x20(%rbp),%rdx
call   1030 <scan_for_intN@plt>
mov    %eax,-0x24(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1156 <scan_for_int16+0x46>
mov    -0x20(%rbp),%rax
mov    %ax,%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_for_int16>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rcx
mov    %rsi,%rbx
lea    0x8(%rsp),%rdx
mov    $0x10,%esi
call   1030 <scan_for_intN@plt>
test   %rbx,%rbx
je     1137 <scan_for_int16+0x27>
movzwl 0x8(%rsp),%ecx
mov    %cx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @scan_for_int16(i8* %0, i16* writeonly %1, i8** %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
%6 = call i32 @scan_for_intN(i8* %0, i32 16, i64* %4, i8** %2)
%7 = icmp eq i16* %1, null
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = load i64, i64* %4
%10 = trunc i64 %9 to i16
store i16 %10, i16* %1
br label %11
11: ; preds = %8, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *argv0) {
  printf("Usage: %s [OPTIONS]\n\n"
         "Supported options:\n"
         "  -i <iface>   Use network interface <iface>\n"
         "  -h           Display this text\n",
         argv0);
  return;
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [119 x i8] c"Usage: %s [OPTIONS]\0A\0ASupported options:\0A -i <iface> Use network interface <iface>\0A -h Display this text\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [119 x i8] c"Usage: %s [OPTIONS]\0A\0ASupported options:\0A -i <iface> Use network interface <iface>\0A -h Display this text\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}